Comments (9)
You could either put those in application.yml
if you don't mind them being Git-ignored or you could just put them in application.rb
or an initializer:
ENV['MY_PUBLIC_CONFIGURATION'] = 'somethingpublic'
Does that help?
from figaro.
I wish thinking there should be an option for Figaro to load in multiple .yml
files. That way, I can store something like config.yml
in revision control while application.yml
contains my sensitive stuff and will be created manually on production. The API could possibly look like
Figaro.configure do |config|
config.files = %w(application.yml config.yml)
end
Thoughts? Would you accept a pull request for this?
from figaro.
The problem with configuring Figaro is that it's kind of… too late. By the time the initializers run, Figaro's already done! That's what allows us to use Figaro-set configurations in other initializers. I would encourage you to set these in your own public, committed Ruby file or add them to application.yml
. You could also roll your own solution (in application.rb
to load in a config.yml
file:
config_path = File.expand_path('../config/config.yml', __FILE__)
ENV.update(YAML.load_file(config_path)) if File.exist?(config_path)
from figaro.
What about a .figaro
file? Just to keep things DRY and also take advantage of the environmental logic that's already built into Figaro.
application.yml
config.yml
from figaro.
Seems that having two configuration files would be repeating yourself, when the job can be done with one. In the past, I've committed an application.example.yml
and that can include all sorts of content and comments regarding what values can stay and which still need to be added.
from figaro.
The two config files would have different roles. For example, application.yml
would look like
SENDGRID_API_KEY: abcdefg
development:
DATABASE_PASSWORD: yomomma
production:
DATABASE_PASSWORD: yodadda
and then config.yml
would look like
USER_LOGIN_MAX_ATTEMPTS: 5
USER_SIGNUP_ENABLED: true
CONTACT_EMAIL: [email protected]
They really shouldn't overlap, although application.yml
if defined first within .figaro
, should take precedence.
puts ENV["USER_LOGIN_MAX_ATTEMPTS"] # 5
The application.example.yml
is still useful, but only for application.yml
since it's not commited to the repository. Say you would like to change the login max attempts, it seems like it would make more sense to commit that to repo rather than go to each of your production servers and change it manually.
from figaro.
Thoughts? 😄
from figaro.
This seems like unnecessary repetition.
By the way, instead of editing files directly on the server which aren't checked into version control, symlink them into a shared directory and use something like capistrano to upload the config. You can even have this run automatically every time you deploy.
after 'deploy:setup' do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
before 'deploy:finalize_update' do
run "ln -sf #{shared_path}/application.yml #{latest_release}/config/application.yml"
end
from figaro.
+1 for this. I often need to have shared and developer specific variables, having two configuration files would be good so I can check in the shared version.
from figaro.
Related Issues (20)
- Dynamically load development or test default values HOT 2
- Can't push application.yml keys to heroku
- figaro heroku:set => “Could not find command heroku:set” HOT 1
- Using with docker and ENV.fetch HOT 1
- ar
- Override contents of generated `application.yml`
- Figaro 2 HOT 3
- Options for Figaro on Elastic BeanStalk HOT 2
- Not working HOT 1
- Environment variables in config/keycloak.yml files, not supported?
- Herarchical structure
- Project status? HOT 15
- Remove escape characters when loading environment values
- Rails and heroku failing tests
- Any npm packages that could use the same secrets? HOT 4
- Starting Rails app through `foreman` doesn't load ENV vars on `config/puma.rb` file
- What do you think about HashiCorp Vault integration?
- `visit_Psych_Nodes_Alias': Unknown alias: shared (Psych::BadAlias) error with ruby 3.1 HOT 3
- Project status (2022) HOT 2
- Undefined method exists? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from figaro.