This is a issue about ruby25_app_builder rather than this gem.
Sorry if it isn't the right place to ask.
I found that environment variables defined in app.yaml cannot be used in gcloud app deploy.
For example, my Rails app initializes an API client on launch.
So I wrote an initializer that reads API key from environment variable:
config/initializers/sample_initializer.rb
api_key = ENV['SAMPLE_API_KEY']
raise 'sample_api_key is required' if api_key.blank?
SampleClient.config.api_key = api_key
Then I deploy this app with gcloud app deploy.
During deploy, ruby25_app_builder automatically runs rails assets:precompile if public/assets does not exists.
But this command fails due to missing env var.
This can be avoided by running RAILS_ENV=production rails assets:precompile in advance.
But I think this should be done by ruby25_app_builder.
Are there any plans to fix this?
Hi,
This is a issue about ruby25_app_builder rather than this gem. Sorry if it isn't the right place to ask.
I found that environment variables defined in app.yaml cannot be used in
gcloud app deploy
.For example, my Rails app initializes an API client on launch. So I wrote an initializer that reads API key from environment variable:
config/initializers/sample_initializer.rb
Then I deploy this app with
gcloud app deploy
. During deploy, ruby25_app_builder automatically runsrails assets:precompile
ifpublic/assets
does not exists. But this command fails due to missing env var.Logs from Cloud Build:
This can be avoided by running
RAILS_ENV=production rails assets:precompile
in advance. But I think this should be done by ruby25_app_builder. Are there any plans to fix this?