summaryrefslogtreecommitdiff
path: root/internal/container/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/container/config.go')
-rw-r--r--internal/container/config.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/internal/container/config.go b/internal/container/config.go
index 149d6b9b..71deafc2 100644
--- a/internal/container/config.go
+++ b/internal/container/config.go
@@ -4,8 +4,8 @@ import (
"fmt"
"time"
- "github.com/roadrunner-server/config/v2"
endure "github.com/roadrunner-server/endure/pkg/container"
+ "github.com/spf13/viper"
)
type Config struct {
@@ -21,8 +21,16 @@ const (
)
// NewConfig creates endure container configuration.
-func NewConfig(cfgPlugin *config.Plugin) (*Config, error) {
- if !cfgPlugin.Has(endureKey) {
+func NewConfig(cfgFile string) (*Config, error) {
+ v := viper.New()
+ v.SetConfigFile(cfgFile)
+
+ err := v.ReadInConfig()
+ if err != nil {
+ return nil, err
+ }
+
+ if !v.IsSet(endureKey) {
return &Config{ // return config with defaults
GracePeriod: defaultGracePeriod,
PrintGraph: false,
@@ -38,7 +46,8 @@ func NewConfig(cfgPlugin *config.Plugin) (*Config, error) {
LogLevel string `mapstructure:"log_level"`
}{}
- if err := cfgPlugin.UnmarshalKey(endureKey, &rrCfgEndure); err != nil {
+ err = v.UnmarshalKey(endureKey, &rrCfgEndure)
+ if err != nil {
return nil, err
}