Commit 2c3ab0f 1 parent 06bcde5 commit 2c3ab0f Copy full SHA for 2c3ab0f
File tree 2 files changed +5
-22
lines changed
2 files changed +5
-22
lines changed Original file line number Diff line number Diff line change 8
8
)
9
9
10
10
type ConfigCtx struct {
11
- viper * viper.Viper
11
+ * viper.Viper
12
12
context.Context
13
13
fmt.Stringer
14
14
}
@@ -20,39 +20,23 @@ func WithContext(ctx context.Context) *ConfigCtx {
20
20
v .AddConfigPath ("." )
21
21
v .AutomaticEnv ()
22
22
23
- return & ConfigCtx {viper : v , Context : ctx }
23
+ return & ConfigCtx {Viper : v , Context : ctx }
24
24
}
25
25
26
- func (c * ConfigCtx ) SetConfigName (name string ) {
27
- c .viper .SetConfigName (name )
28
- }
29
-
30
- func (c * ConfigCtx ) SetConfigType (typ string ) {
31
- c .viper .SetConfigType (typ )
32
- }
33
-
34
- func (c * ConfigCtx ) AddConfigPath (paths ... string ) {
26
+ func (c * ConfigCtx ) AddConfigPaths (paths ... string ) {
35
27
for _ , path := range paths {
36
- c .viper .AddConfigPath (path )
28
+ c .Viper .AddConfigPath (path )
37
29
}
38
30
}
39
31
40
- func (c * ConfigCtx ) ReadInConfig () error {
41
- return c .viper .ReadInConfig ()
42
- }
43
-
44
- func (c * ConfigCtx ) Unmarshal (v any ) error {
45
- return c .viper .Unmarshal (v )
46
- }
47
-
48
32
func (c * ConfigCtx ) Value (key any ) any {
49
33
vk , ok := key .(string )
50
34
51
35
if ! ok {
52
36
return c .Context .Value (key )
53
37
}
54
38
55
- if val := c .viper .Get (vk ); val != nil {
39
+ if val := c .Viper .Get (vk ); val != nil {
56
40
return val
57
41
}
58
42
return c .Context .Value (key )
Original file line number Diff line number Diff line change @@ -44,5 +44,4 @@ func main() {
44
44
if err := webx .ListenAndServe (appConf .Web .Addr , root ); err != nil {
45
45
log .Fatal (err )
46
46
}
47
-
48
47
}
You can’t perform that action at this time.
0 commit comments