$ rails -v
Rails 6.0.3.1
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
Gemfile
gem 'config'
$ bundle install --path vendor/bundle
Install related files for config initialization
$ bundle exec rails g config:install
config/settings.yml
service:
name: 'vdeep'
url: 'http://vdeep.net'
authentication_password: "foobarbaz"
$ rails c
> Settings.service.name
=> "vdeep"
> Settings.service[:name]
=> "vdeep"
> Settings[:service][:name]
=> "vdeep"
> Settings.authentication_password
=> "foobarbaz"
Recommended Posts