Why is "ENV variable 'S3_KEY' needs to be set" being thrown on deployment?
I'd like to use heroku_san
to deploy multiple environments to heroku. I'm using dragonfly for image handling and S3 for storage. Usually you can add your key and secret for the storage using heroku config:add S3_KEY=… S3_SECRET=…
directly.
So I've added these details to the heroku.yml
file used by heroku_san
:
开发者_JAVA百科staging:
app: app-staging
config: &default
BUNDLE_WITHOUT: "development:test"
S3_KEY: XXXXXXXXXXXXXXXXXX
S3_SECRET: XXXXXXXXXXXXXXXXXX
S3_BUCKET: app-staging
but when deploying I'm still getting:
rake aborted!
ENV variable 'S3_KEY' needs to be set - use
heroku config:add S3_KEY=XXXXXXXXX
What am I missing here? Is there a better way then storing this information in a YML file?
There's no need to run heroku config:add
manually. Just run heroku_san's config task:
$ rake all heroku:config
Repeat this whenever you update the heroku.yml file.
I was confused about this too, since it's strangely absent from heroku_san's documentation, but the option does appear in the list of rake tasks:
$ rake -T
and in the heroku_san code: https://github.com/fastestforward/heroku_san/blob/master/lib/heroku_san/tasks.rb
A simple solution/work-around:
heroku config:add S3_KEY=XXX S3_SECRET=XXX --app app-staging
Any better ideas?
I think you need to run the command rake all heroku:rack_env
. This command will then set the environment configurations for you based on your heroku_san YAML configuration.
精彩评论