Skip to content

Commit

Permalink
also support an environment variable with the path
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcichra committed Aug 16, 2021
1 parent 671988e commit 79e6d48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ func loadConfig(filename string) *Config {

func main() {
// get the first argument as the config file
// or check for the environment variable KARMEN_CONFIG
if len(os.Args) > 1 {
configFile := os.Args[1]
serveGRPC(loadConfig(configFile))
} else if os.Getenv("KARMEN_CONFIG") != "" {
serveGRPC(loadConfig(os.Getenv("KARMEN_CONFIG")))
} else {
log.Println("Usage: karmen <config file>")
}
Expand Down

0 comments on commit 79e6d48

Please sign in to comment.