ruby-on-railsenvironment-variablesfigaro-ruby

Separate environment variables into different environments


I'm drawing a blank. I'm trying to set environment variable in my Rails 6 app. I have installed figaro and can set variables like normal. But what I'm trying to do is set a default set of variables along with dev/staging/production.

I think it was something like:

# config/application.yml

defaults: 
  ...environment variables...

development: <<&defaults
  development variables...
production: <<&defaults
  production variables

I'm blanking on how to include the defaults for each environment and my google fu is failing me at the moment.


Solution

  • Found the answer in some other posts dealing with environments

    default: &defaults
    # Environment variables
    
    development: &development
      <<: *defaults
    production:
      <<: *development