Skip to content

Instantly share code, notes, and snippets.

/problematic.rb Secret

Created July 2, 2017 03:09
Show Gist options
  • Save anonymous/facae134edce59b32556c9bf2ad6b5f3 to your computer and use it in GitHub Desktop.
Save anonymous/facae134edce59b32556c9bf2ad6b5f3 to your computer and use it in GitHub Desktop.
if Rails.env.development?
s3_options = {
access_key_id: 'abc',
secret_access_key: '123',
region: 'my-region',
bucket: 'my-bucket',
endpoint: 'http://localhost:4567/',
force_path_style: true
}
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new(Dir.tmpdir, prefix: 'foo'),
store: Shrine::Storage::S3.new(prefix: 'bar', s3_options)
}
else
Shrine.storages = {
# Lorem ipsum
cache: Shrine::Storage::FileSystem.new('/storage', prefix: 'foo'),
store: Shrine::Storage::S3.new(prefix: 'bar', **s3_options)
}
s3_options = {
access_key_id: Rails.application.secrets.AWS_ACCESS_KEY_ID,
secret_access_key: Rails.application.secrets.AWS_SECRET_ACCESS_KEY,
region: Rails.application.secrets.AWS_REGION,
bucket: Rails.application.secrets.AWS_BUCKET_NAME
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment