chore(sources/env): bump gosettings to v0.3.0-rc9
This commit is contained in:
19
internal/configuration/sources/env/version.go
vendored
19
internal/configuration/sources/env/version.go
vendored
@@ -1,32 +1,15 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gosettings/sources/env"
|
||||
"github.com/qdm12/govalid/binary"
|
||||
)
|
||||
|
||||
func readVersion() (version settings.Version, err error) {
|
||||
version.Enabled, err = readVersionEnabled()
|
||||
version.Enabled, err = env.BoolPtr("VERSION_INFORMATION")
|
||||
if err != nil {
|
||||
return version, err
|
||||
}
|
||||
|
||||
return version, nil
|
||||
}
|
||||
|
||||
func readVersionEnabled() (enabled *bool, err error) {
|
||||
s := env.Get("VERSION_INFORMATION")
|
||||
if s == "" {
|
||||
return nil, nil //nolint:nilnil
|
||||
}
|
||||
|
||||
enabled, err = binary.Validate(s)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("environment variable VERSION_INFORMATION: %w", err)
|
||||
}
|
||||
|
||||
return enabled, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user