SetPluginConfig sets the option to the given value for the given plugin. Passing a value of "" will remove the option. If removing the final config item for a given plugin then also cleans up the overall plugin entry.
(pluginname, option, value string)
| 453 | // the final config item for a given plugin then also cleans up the |
| 454 | // overall plugin entry. |
| 455 | func (c *ConfigFile) SetPluginConfig(pluginname, option, value string) { |
| 456 | if c.Plugins == nil { |
| 457 | c.Plugins = make(map[string]map[string]string) |
| 458 | } |
| 459 | pluginConfig, ok := c.Plugins[pluginname] |
| 460 | if !ok { |
| 461 | pluginConfig = make(map[string]string) |
| 462 | c.Plugins[pluginname] = pluginConfig |
| 463 | } |
| 464 | if value != "" { |
| 465 | pluginConfig[option] = value |
| 466 | } else { |
| 467 | delete(pluginConfig, option) |
| 468 | } |
| 469 | if len(pluginConfig) == 0 { |
| 470 | delete(c.Plugins, pluginname) |
| 471 | } |
| 472 | } |
no outgoing calls