|
@@ -68,8 +68,21 @@ func (c *config) Set(module, key string, value any) {
|
|
|
c.Viper.Set(module+"."+key, value)
|
|
|
}
|
|
|
|
|
|
-func (c *config) Unmarshal(module, key string, value any) error {
|
|
|
- return c.Viper.UnmarshalKey(module+"."+key, value)
|
|
|
+func (c *config) Unmarshal(value any, arr ...string) error {
|
|
|
+ key := ""
|
|
|
+
|
|
|
+ for _, s := range arr {
|
|
|
+ if len(key) != 0 {
|
|
|
+ key += "."
|
|
|
+ }
|
|
|
+ key += s
|
|
|
+ }
|
|
|
+ if len(key) != 0 {
|
|
|
+ return c.Viper.UnmarshalKey(key, value)
|
|
|
+ } else {
|
|
|
+ return c.Viper.Unmarshal(value)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func (c *config) ReadConfigAndFileExist() (bool, error) {
|