Skip to content

Commit

Permalink
support for yaml in mongodb.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Fedotov committed Jul 28, 2020
1 parent a8a5857 commit bb41b60
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/puppet/provider/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def self.mongod_conf_file
def self.mongo_conf
config = YAML.load_file(mongod_conf_file) || {}
{
'bindip' => config['net.bindIp'],
'port' => config['net.port'],
'ipv6' => config['net.ipv6'],
'allowInvalidHostnames' => config['net.ssl.allowInvalidHostnames'],
'ssl' => config['net.ssl.mode'],
'sslcert' => config['net.ssl.PEMKeyFile'],
'sslca' => config['net.ssl.CAFile'],
'auth' => config['security.authorization'],
'shardsvr' => config['sharding.clusterRole'],
'confsvr' => config['sharding.clusterRole']
'bindip' => config['net.bindIp'] || config.fetch('net', {}).fetch('bindIp', nil),
'port' => config['net.port'] || config.fetch('net', {}).fetch('port', nil),
'ipv6' => config['net.ipv6'] || config.fetch('net', {}).fetch('ipv6', nil),
'allowInvalidHostnames' => config['net.ssl.allowInvalidHostnames'] || config.fetch('net', {}).fetch('ssl', {}).fetch('allowInvalidHostnames', nil),
'ssl' => config['net.ssl.mode'] || config.fetch('net', {}).fetch('ssl', {}).fetch('mode', nil),
'sslcert' => config['net.ssl.PEMKeyFile'] || config.fetch('net', {}).fetch('ssl', {}).fetch('PEMKeyFile', nil),
'sslca' => config['net.ssl.CAFile'] || config.fetch('net', {}).fetch('ssl', {}).fetch('CAFile', nil),
'auth' => config['security.authorization'] || config.fetch('security', {}).fetch('authorization', nil),
'shardsvr' => config['sharding.clusterRole'] || config.fetch('sharding',{}).fetch('clusterRole', nil),
'confsvr' => config['sharding.clusterRole'] || config.fetch('sharding', {}).fetch('clusterRole', nil)
}
end

Expand Down

0 comments on commit bb41b60

Please sign in to comment.