IsSet checks if a config is set
(key string)
| 345 | |
| 346 | // IsSet checks if a config is set |
| 347 | func (c *LiveConfig) IsSet(key string) bool { |
| 348 | matches := regexp.MustCompile("\b*--([a-z-_]+)").FindAllStringSubmatch(strings.Join(os.Args, " "), -1) |
| 349 | if len(matches) == 0 { |
| 350 | return false |
| 351 | } |
| 352 | |
| 353 | if len(c.cliArgs) == 0 { |
| 354 | args := make(map[string]bool) |
| 355 | for _, match := range matches { |
| 356 | args[match[1]] = true |
| 357 | } |
| 358 | c.cliArgs = args |
| 359 | } |
| 360 | return c.cliArgs[key] |
| 361 | } |
| 362 | |
| 363 | // GetString returns a config value as a string. |
| 364 | func (c *LiveConfig) GetString(ns, key string) (string, error) { |
no outgoing calls
no test coverage detected