(hostname, key string)
| 76 | } |
| 77 | |
| 78 | func (c *cfg) GetOrDefault(hostname, key string) o.Option[gh.ConfigEntry] { |
| 79 | if val := c.get(hostname, key); val.IsSome() { |
| 80 | // Map the Option[string] to Option[gh.ConfigEntry] with a source of ConfigUserProvided |
| 81 | return o.Map(val, toConfigEntry(gh.ConfigUserProvided)) |
| 82 | } |
| 83 | |
| 84 | if defaultVal := defaultFor(key); defaultVal.IsSome() { |
| 85 | // Map the Option[string] to Option[gh.ConfigEntry] with a source of ConfigDefaultProvided |
| 86 | return o.Map(defaultVal, toConfigEntry(gh.ConfigDefaultProvided)) |
| 87 | } |
| 88 | |
| 89 | return o.None[gh.ConfigEntry]() |
| 90 | } |
| 91 | |
| 92 | // toConfigEntry is a helper function to convert a string value to a ConfigEntry with a given source. |
| 93 | // |
no test coverage detected