-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Howto: Best practice to make it work from servers in Russia? #29
Comments
Hi! We will add possibility to answer webhooks in 2-3 days (#30). |
I mean, not only answer to them but sending requests too, in general. |
Аbout proxy, you can set it up in your http client config: |
@trogwarz Can you send me your YAML config? Because I need to know, what do you use, Symfony HTTP client, buzz, guzzle, or something else. |
@Big-Shark I think you can show examples for few clients. It's may come in handy for all. |
Sure. Here is some info about packages and versions i'm using. From server that is outside of Russia – works perfectly. It would be great to write help information about proxy config in that situation.
Config files:
services:
# Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories)
Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory'
# Register nyholm/psr7 services for autowiring with HTTPlug factories
Http\Message\MessageFactory: '@nyholm.psr7.httplug_factory'
Http\Message\RequestFactory: '@nyholm.psr7.httplug_factory'
Http\Message\ResponseFactory: '@nyholm.psr7.httplug_factory'
Http\Message\StreamFactory: '@nyholm.psr7.httplug_factory'
Http\Message\UriFactory: '@nyholm.psr7.httplug_factory'
nyholm.psr7.psr17_factory:
class: Nyholm\Psr7\Factory\Psr17Factory
nyholm.psr7.httplug_factory:
class: Nyholm\Psr7\Factory\HttplugFactory
services:
TgBotApi\BotApiBase\ApiClient:
arguments:
$requestFactory: '@Psr\Http\Message\RequestFactoryInterface'
$streamFactory: '@Psr\Http\Message\StreamFactoryInterface'
$client: '@Psr\Http\Client\ClientInterface'
TgBotApi\BotApiBase\BotApiNormalizer: null
TgBotApi\BotApiBase\ApiClientInterface: '@TgBotApi\BotApiBase\ApiClient'
TgBotApi\BotApiBase\NormalizerInterface: '@TgBotApi\BotApiBase\BotApiNormalizer'
TgBotApi\BotApiBase\BotApi:
arguments:
$botKey: '%env(resolve:TG_BOT_API_KEY)%'
$apiClient: '@TgBotApi\BotApiBase\ApiClientInterface'
$normalizer: '@TgBotApi\BotApiBase\NormalizerInterface'
TgBotApi\BotApiBase\BotApiComplete:
parent: TgBotApi\BotApiBase\BotApi
TgBotApi\BotApiBase\BotApiInterface: '@TgBotApi\BotApiBase\BotApi' |
@trogwarz You can try this. services:
GuzzleHttp\Client:
arguments:
- { timeout: 120, proxy : '%env(TELEGRAM_PROXY)%'}
Http\Adapter\Guzzle6\Client:
arguments:
- '@GuzzleHttp\Client'
TgBotApi\BotApiBase\ApiClient:
arguments:
$requestFactory: '@Psr\Http\Message\RequestFactoryInterface'
$streamFactory: '@Psr\Http\Message\StreamFactoryInterface'
$client: '@Http\Adapter\Guzzle6\Client:' |
Sorry for late answer. This works, thank you! |
I have servers in Russia but Telegram servers are blocked.
Is there any good way to set in config proxy path? Or i need to patch/extend source code of this library?
And how exactly? Thanks.
The text was updated successfully, but these errors were encountered: