AddConfig adds a new section->key:value to the configuration.
(section string, option string, value string)
| 73 | |
| 74 | // AddConfig adds a new section->key:value to the configuration. |
| 75 | func (c *Config) AddConfig(section string, option string, value string) bool { |
| 76 | if section == "" { |
| 77 | section = DEFAULT_SECTION |
| 78 | } |
| 79 | |
| 80 | if _, ok := c.data[section]; !ok { |
| 81 | c.data[section] = make(map[string]string) |
| 82 | } |
| 83 | |
| 84 | _, ok := c.data[section][option] |
| 85 | c.data[section][option] = value |
| 86 | |
| 87 | return !ok |
| 88 | } |
| 89 | |
| 90 | func (c *Config) parse(fname string) (err error) { |
| 91 | f, err := os.Open(fname) |