mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 11:25:41 +03:00
Added Config.Options so we can support arbitrary key-value configuration
This commit is contained in:
@@ -40,4 +40,27 @@ type Config struct {
|
||||
|
||||
// Node provides the base node
|
||||
Node *structs.Node
|
||||
|
||||
// Options provides arbitrary key-value configuration for nomad internals,
|
||||
// like fingerprinters and drivers. The format is:
|
||||
//
|
||||
// namespace.option = value
|
||||
Options map[string]string
|
||||
}
|
||||
|
||||
func NewConfig() Config {
|
||||
config := Config{
|
||||
Node: &structs.Node{},
|
||||
Options: map[string]string{},
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// GetOpt returns the specified configuration value or "".
|
||||
func (c *Config) Read(id string) string {
|
||||
val, ok := c.Options[id]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user