Skip to content
Snippets Groups Projects

Use config package to handle all controller configurations

Merged Ghost User requested to merge istaester/provide-config-package into develop
Compare and Show latest version
3 files
+ 9
14
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 8
9
@@ -6,14 +6,16 @@ import (
"github.com/google/uuid"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
const (
defaultTimeOutDuration10minutes = "10m"
defaultTimeOutDuration10minutes = time.Minute * 10
basePNDUUIDKey = "basePNDUUID"
baseSouthBoundTypeKey = "baseSouthBoundType"
baseSouthBoundUUIDKey = "baseSouthBoundUUID"
changeTimeoutKey = "GOSDN_CHANGE_TIMEOUT"
)
// BasePndUUID is an uuid for the base PND
@@ -89,18 +91,15 @@ func getUUIDFromViper(viperKey string) (uuid.UUID, error) {
}
func setChangeTimeout() error {
var err error
e := os.Getenv("GOSDN_CHANGE_TIMEOUT")
e := os.Getenv(changeTimeoutKey)
if e != "" {
ChangeTimeout, err = time.ParseDuration(e)
changeTimeout, err := time.ParseDuration(e)
if err != nil {
return err
log.Fatal(err)
}
ChangeTimeout = changeTimeout
} else {
ChangeTimeout, err = time.ParseDuration(defaultTimeOutDuration10minutes)
if err != nil {
return err
}
ChangeTimeout = time.Minute * 10
}
return nil
Loading