This PR adds an ability to set default key for environmental YAML files.
To provide default values we can use YAML anchors, but they do not deep-merge settings, so this PR provides a way to define a special top-level key for default values like this:
After that, Anyway Config will start reading settings under the "default" key and then merge environmental settings into them.
default:
server: # This values will be loaded in all environments by default
host: localhost
port: 3002
staging:
server:
host: staging.example.com # This value will override the defaults when Rails.env.staging? is true
# port will be set to the value from the defaults — 3002
Is there anything you'd like reviewers to focus on?
In this implementation, a file with only the default key is considered environmental:
default:
server: # This values will be loaded in all environments by default
host: localhost
port: 3002
What is the purpose of this pull request?
This PR adds an ability to set default key for environmental YAML files.
To provide default values we can use YAML anchors, but they do not deep-merge settings, so this PR provides a way to define a special top-level key for default values like this:
After that, Anyway Config will start reading settings under the
"default"
key and then merge environmental settings into them.Is there anything you'd like reviewers to focus on?
In this implementation, a file with only the default key is considered environmental:
Checklist