This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows for extra configuration with the 'graphite' key.
A Chef node considers hash keys as strings, by having symbols and strings the hash can not merge properly and as a result, adding another `graphite` key to the `extra_config` results in a hash with two `graphite` keys. The result is that there is no way at the moment to add any more values to the `graphite` key (see https://github.com/etsy/statsd/blob/master/docs/namespacing.md for more examples) To go around this problem the first thing to do is to remove symbols from the `config_hash` hash and turn them into strings. The second thing is to then do a "deep merge" since a regular merge will only go down one level in the hash. To accomplish this we take advantage of the Chef Mixins. `config_hash` should really be a node attribute to prevent this type of behavior and let Chef handle the deep merges but for the sake of backward compatibility it was left as is. However this should be considered when bumping the cookbook to a major release. This allows the user to do things like this: ```ruby node.default['statsd']['extra_config'] = { 'graphite' => { 'globalPrefix' => 'something' }, } ``` And the output of the config.js will be ``` "graphite": { "legacyNamespace": false, "globalPrefix": "something" }, ```
- Loading branch information