mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Parse Client config Options
This adds Options to the agent ClientConfig and fixes the merging logic to include Options, as defined in the docs
This commit is contained in:
@@ -192,6 +192,7 @@ func (a *Agent) setupClient() error {
|
||||
conf.AllocDir = a.config.Client.AllocDir
|
||||
}
|
||||
conf.Servers = a.config.Client.Servers
|
||||
conf.Options = a.config.Client.Options
|
||||
|
||||
// Setup the node
|
||||
conf.Node = new(structs.Node)
|
||||
|
||||
@@ -137,6 +137,12 @@ type ClientConfig struct {
|
||||
// NodeClass is used to group the node by class
|
||||
NodeClass string `hcl:"node_class"`
|
||||
|
||||
// Options is used for configuration of nomad internals,
|
||||
// like fingerprinters and drivers. The format is:
|
||||
//
|
||||
// namespace.option = value
|
||||
Options map[string]string `hcl:"options"`
|
||||
|
||||
// Metadata associated with the node
|
||||
Meta map[string]string `hcl:"meta"`
|
||||
}
|
||||
@@ -388,6 +394,14 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
|
||||
// Add the servers
|
||||
result.Servers = append(result.Servers, b.Servers...)
|
||||
|
||||
// Add the options map values
|
||||
if result.Options == nil {
|
||||
result.Options = make(map[string]string)
|
||||
}
|
||||
for k, v := range b.Options {
|
||||
result.Options[k] = v
|
||||
}
|
||||
|
||||
// Add the meta map values
|
||||
if result.Meta == nil {
|
||||
result.Meta = make(map[string]string)
|
||||
|
||||
Reference in New Issue
Block a user