简体   繁体   English

将环境变量分到不同的环境中

[英]Separate environment variables into different environments

I'm drawing a blank.我在画一个空白。 I'm trying to set environment variable in my Rails 6 app.我正在尝试在我的 Rails 6 应用程序中设置环境变量。 I have installed figaro and can set variables like normal.我已经安装了 figaro 并且可以像平常一样设置变量。 But what I'm trying to do is set a default set of variables along with dev/staging/production.但是我想要做的是设置一组默认的变量以及 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.我正在考虑如何包含每个环境的默认值,而我的 google fu 目前让我失望。

Found the answer in some other posts dealing with environments在其他一些处理环境的帖子中找到了答案

default: &defaults
# Environment variables

development: &development
  <<: *defaults
production:
  <<: *development

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM