File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,16 @@ func main() {
4343 log .Notice (fmt .Sprintf ("fsnotify watcher create failed : %v" , err ))
4444 os .Exit (1 )
4545 }
46- if err := fswatch .Add (watchPath ); err != nil {
47- log .Notice (fmt .Sprintf ("watch failed : %v" , err ))
48- os .Exit (1 )
46+
47+ if utils .DisableReload () {
48+ log .Notice ("reload disabled, no watches added" )
49+ } else {
50+ if err := fswatch .Add (watchPath ); err != nil {
51+ log .Notice (fmt .Sprintf ("watch failed : %v" , err ))
52+ os .Exit (1 )
53+ }
54+ log .Notice (fmt .Sprintf ("watch : %s" , watchPath ))
4955 }
50- log .Notice (fmt .Sprintf ("watch : %s" , watchPath ))
5156
5257 // flag used for termination handling
5358 var terminated bool
Original file line number Diff line number Diff line change @@ -55,3 +55,10 @@ func LoadEnvFile() []string {
5555
5656 return env
5757}
58+
59+ func DisableReload () bool {
60+ if str , ok := os .LookupEnv ("DISABLE_RELOAD" ); ok {
61+ return strings .EqualFold (str , "true" )
62+ }
63+ return false
64+ }
You can’t perform that action at this time.
0 commit comments