mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-28 18:41:30 +02:00
[management,signal,proxy,relay,misc] Unify service configuration loading
Service entry points currently resolve defaults, files, environment variables, and flags differently, which makes precedence inconsistent and prevents some services from using config files. Introduce one Viper-backed loader and migrate Combined, Management, Relay, Signal, and Proxy while preserving compatibility aliases and Management template expansion.
This commit is contained in:
@@ -49,6 +49,16 @@ func Parse(raw string) (*List, error) {
|
||||
return &List{prefixes: prefixes}, nil
|
||||
}
|
||||
|
||||
// UnmarshalText parses trusted proxy prefixes from text configuration.
|
||||
func (l *List) UnmarshalText(text []byte) error {
|
||||
parsed, err := Parse(string(text))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*l = *parsed
|
||||
return nil
|
||||
}
|
||||
|
||||
// FromPrefixes wraps an already-parsed set of prefixes in a List.
|
||||
func FromPrefixes(prefixes []netip.Prefix) *List {
|
||||
return &List{prefixes: prefixes}
|
||||
|
||||
Reference in New Issue
Block a user