impress/config/initializers/aws_s3.rb
Matchu 0d6caceb24 improve app infrastructure to make a dev environment easier to reproduce
This commit will require a few changes to the deployment process:
* store AWS credentials in AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars
* store OpenNeo Auth credentials in OPENNEO_AUTH_APP, OPENNEO_AUTH_SERVER, and OPENNEO_AUTH_SECRET env vars

STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY are now required, too; better have a good .env.
You can always put in dummy values if you have no credentials, though; they only get called up if there's a transaction.

SECRET_TOKEN is now an env var, too, but the production deploy process currently replaces config/initializers/secret_token.rb anyway; this might be the way to go later, though.
2015-07-16 17:44:52 -04:00

13 lines
411 B
Ruby

access_key_id = ENV.fetch('AWS_ACCESS_KEY_ID')
secret_access_key = ENV.fetch('AWS_SECRET_ACCESS_KEY')
def set(params, params_key, env_key)
params[params_key] = ENV[env_key] if ENV.has_key?(env_key)
end
params = {}
set params, :server, 'AWS_SERVER_HOST'
set params, :port, 'AWS_SERVER_PORT'
set params, :protocol, 'AWS_SERVER_PROTOCOL'
IMPRESS_S3 = RightAws::S3.new access_key_id, secret_access_key, params