File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ import (
27
27
"gopkg.in/yaml.v3"
28
28
)
29
29
30
+ func init () {
31
+ err := LoadConfig ()
32
+ if err != nil {
33
+ panic (err )
34
+ }
35
+ }
36
+
30
37
type RawConfig struct {
31
38
Ref map [string ]interface {} `yaml:"ref"`
32
39
Debug bool `yaml:"debug"`
@@ -101,6 +108,8 @@ func GetRef(name string) *RefConfig {
101
108
return refConfig
102
109
}
103
110
111
+ // LoadConfig by default, config will load only once when the program is invoked, also the same for each plugin
112
+ // but for sdk mode, config should be reloaded each time when the sdk is called. so we provide this api and manually call this in sdk mode.
104
113
func LoadConfig () error {
105
114
config , err := initConfig ()
106
115
if err != nil {
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ import (
20
20
"runtime/debug"
21
21
"runtime/pprof"
22
22
23
- "github.com/cloudwego/thriftgo/config"
24
-
25
23
"time"
26
24
27
25
"github.com/cloudwego/thriftgo/args"
41
39
var debugMode bool
42
40
43
41
func init () {
44
- err := config .LoadConfig ()
45
- if err != nil {
46
- panic (err )
47
- }
48
42
_ = g .RegisterBackend (new (golang.GoBackend ))
49
43
// export THRIFTGO_DEBUG=1
50
44
debugMode = os .Getenv ("THRIFTGO_DEBUG" ) == "1"
You can’t perform that action at this time.
0 commit comments