Needs credentials when building assets with SECRET_KEY_BASE_DUMMY
When building a docker image, it is recommended practice to do that as follows
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
This will cause Telegram::Bot to fail with Telegram::Bot::Client :default not configured.
I helped myself with using the following code in config/routes.rb:
unless ENV['SECRET_KEY_BASE_DUMMY']
telegram_webhook TelegramWebhooksController
end
But it feels ugly and I think there should be a better out of the box solution, as everybody will have this problem who tries to deploy via docker
I encountered the same issue. Ideally, it would be great to have the option to configure the Telegram token separately, in an initializer. Otherwise, it's not immediately clear where this configuration is happening.
For now, I'm using the same workaround.
It's possible to configure bots in an initializer. See Configuration in readme.
Token is used to build a route. So you'll have to use some workaround if you want to run app without secrets. Either this or add a token placeholder.
@printercu If that's the way to go, I would suggest to mention it somewhere in the documentation, because everybody who builds a docker image with Rails and your gem will fall into that trap.