Skip to content
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

Needs credentials when building assets with SECRET_KEY_BASE_DUMMY #247

Open
thomaswitt opened this issue Oct 10, 2024 · 3 comments
Open

Comments

@thomaswitt
Copy link

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

@dankimio
Copy link

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.

@printercu
Copy link
Member

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.

@thomaswitt
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants