File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,8 @@ type ServerCfg struct {
62
62
// default config
63
63
var defaultConf = ServerCfg {
64
64
ConfigFile : "livego.yaml" ,
65
- FLVArchive : false ,
66
- RTMPNoAuth : false ,
65
+ FLVArchive : false ,
66
+ RTMPNoAuth : false ,
67
67
RTMPAddr : ":1935" ,
68
68
HTTPFLVAddr : ":7001" ,
69
69
HLSAddr : ":7002" ,
@@ -82,7 +82,15 @@ var defaultConf = ServerCfg{
82
82
}},
83
83
}
84
84
85
- var Config = viper .New ()
85
+ var (
86
+ Config = viper .New ()
87
+
88
+ // BypassInit can be used to bypass the init() function by setting this
89
+ // value to True at compile time.
90
+ //
91
+ // go build -ldflags "-X 'github.com/gwuhaolin/livego/configure.BypassInit=true'" -o livego main.go
92
+ BypassInit string = ""
93
+ )
86
94
87
95
func initLog () {
88
96
if l , err := log .ParseLevel (Config .GetString ("level" )); err == nil {
@@ -92,6 +100,12 @@ func initLog() {
92
100
}
93
101
94
102
func init () {
103
+ if BypassInit == "" {
104
+ initDefault ()
105
+ }
106
+ }
107
+
108
+ func initDefault () {
95
109
defer Init ()
96
110
97
111
// Default config
You can’t perform that action at this time.
0 commit comments