(hostname, key string)
| 67 | } |
| 68 | |
| 69 | func (c *cfg) GetOrDefault(hostname, key string) o.Option[gh.ConfigEntry] { |
| 70 | if val := c.get(hostname, key); val.IsSome() { |
| 71 | // Map the Option[string] to Option[gh.ConfigEntry] with a source of ConfigUserProvided |
| 72 | return o.Map(val, toConfigEntry(gh.ConfigUserProvided)) |
| 73 | } |
| 74 | |
| 75 | if defaultVal := defaultFor(key); defaultVal.IsSome() { |
| 76 | // Map the Option[string] to Option[gh.ConfigEntry] with a source of ConfigDefaultProvided |
| 77 | return o.Map(defaultVal, toConfigEntry(gh.ConfigDefaultProvided)) |
| 78 | } |
| 79 | |
| 80 | return o.None[gh.ConfigEntry]() |
| 81 | } |
| 82 | |
| 83 | // toConfigEntry is a helper function to convert a string value to a ConfigEntry with a given source. |
| 84 | // |
no test coverage detected