Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ func main() {
log.Notice(fmt.Sprintf("fsnotify watcher create failed : %v", err))
os.Exit(1)
}
if err := fswatch.Add(watchPath); err != nil {
log.Notice(fmt.Sprintf("watch failed : %v", err))
os.Exit(1)

if utils.DisableReload() {
log.Notice("reload disabled, no watches added")
} else {
if err := fswatch.Add(watchPath); err != nil {
log.Notice(fmt.Sprintf("watch failed : %v", err))
os.Exit(1)
}
log.Notice(fmt.Sprintf("watch : %s", watchPath))
}
log.Notice(fmt.Sprintf("watch : %s", watchPath))

// flag used for termination handling
var terminated bool
Expand Down
7 changes: 7 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ func LoadEnvFile() []string {

return env
}

func DisableReload() bool {
if str, ok := os.LookupEnv("DISABLE_RELOAD"); ok {
return strings.EqualFold(str, "true")
}
return false
}
Loading