X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Fconfig.go;h=94e88a181b23e9aaa9b6ca3b720106fa3c434dfe;hb=5953f7e372df54c71f526e9519e8eb0ee7ee6f72;hp=c63e32c21db3ea9ce2f346435e1e83a1c98fce58;hpb=2e78e42c5896b61b77ab3a97e45704f6749161b2;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/config.go b/pkg/xapp/config.go old mode 100755 new mode 100644 index c63e32c..94e88a1 --- a/pkg/xapp/config.go +++ b/pkg/xapp/config.go @@ -24,6 +24,7 @@ import ( "github.com/fsnotify/fsnotify" "github.com/spf13/viper" "os" + "path/filepath" ) type Configurator struct { @@ -41,8 +42,8 @@ func parseCmd() string { return *fileName } -func LoadConfig() (l Log) { - l = Log{} +func LoadConfig() (l *Log) { + l = NewLogger(filepath.Base(os.Args[0])) viper.SetConfigFile(parseCmd()) if err := viper.ReadInConfig(); err != nil { @@ -79,3 +80,23 @@ func (*Configurator) GetString(key string) string { func (*Configurator) GetInt(key string) int { return viper.GetInt(key) } + +func (*Configurator) GetUint32(key string) uint32 { + return viper.GetUint32(key) +} + +func (*Configurator) GetBool(key string) bool { + return viper.GetBool(key) +} + +func (*Configurator) Get(key string) interface{} { + return viper.Get(key) +} + +func (*Configurator) GetStringSlice(key string) []string { + return viper.GetStringSlice(key) +} + +func (*Configurator) GetStringMap(key string) map[string]interface{} { + return viper.GetStringMap(key) +}