I use fog and carrierwave. Right now I just have simple uploader that I run locally:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['S3_ACCESS_KEY'],
:aws_secret_access_key => ENV['S3_SECRET_KEY'],
:region => 'us-west-1', # Change this for
}
config.fog_directory = "bucket-main"
end
But now I have a question where should I save my secret keys.
On heroku environment I could print like this
$ heroku config:set S3_ACCESS_KEY=THERANDOMKEYYOUGOT
$ heroku config:set S3_SECRET_KEY=an0tHeRstRing0frAnDomjUnK
$ heroku config:set S3_REGION=us-west-2
$ heroku config:set S3_BUCKET=my-sample-app-bucket-20160126
But I don't know what to do on my local machine.
I've followed this tutorial http://ift.tt/1Kvk5J8
And stored my keys in config/secrets.yml file
which I just created:
development: &defaults
S3_ACCESS_KEY: "AKHJJHHJHJJHHJHJDHJDDJDHJDHJDJHDRANDOMFQ"
S3_SECRET_KEY: "HfkdjgjkfjkgjkfjkRANDOM2JSJDKKJJKSSJDJKSKaN"
test:
<<: *defaults
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
<<: *defaults
But rails s command gives me this error: /home/jonstark/.rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/fog-core-1.35.0/lib/fog/core/service.rb:244:in `validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
Soo what do I do?
Aucun commentaire:
Enregistrer un commentaire