diff --git a/dockerfile b/dockerfile index 882e737..d21b46c 100644 --- a/dockerfile +++ b/dockerfile @@ -29,4 +29,4 @@ USER nonroot:nonroot ENV TOKEN="" -ENTRYPOINT /flagbot -t ${TOKEN} -c /config +ENTRYPOINT ["/flagbot", "-c", "/config"] diff --git a/flagbot.go b/flagbot.go index aaaac48..afb65da 100644 --- a/flagbot.go +++ b/flagbot.go @@ -43,10 +43,13 @@ func init() { flag.StringVar(&configurationPath, "c", "configuration", "Configuration directory path") flag.Parse() - // Check if discord token was properly parsed. If not exit + // Check if discord token was properly parsed. If not, check env. If not, exit if token == "" { - log.Error("Error in parsing command. Proper Usage: flagbot -t -c ") - os.Exit(1) + token = os.Getenv("TOKEN") + if token == "" { + log.Error("No token supplied") + os.Exit(1) + } } // Load files into their respective variables