Search code examples
environment-variablesfog

How do I centrally configure Fog credentials using environment variables?


Other questions answer how to open (and save) a Fog connection with ENV variables, or how to configure Carrierwave with ENV variables, but I want to set the Fog credentials universally and in one place.


Solution

  • Fog.credentials = {            
      :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
      :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
    }