Add the ability to change the config file's path via args

This commit is contained in:
blank X 2021-09-04 09:31:43 +07:00
parent 804659f860
commit 1c566bad35
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,11 @@ func init() {
}
logger = tmpLogger
defer logger.Sync()
dat, err := os.ReadFile("config.yaml")
configFilename := "config.yaml"
if len(os.Args) == 2 {
configFilename = os.Args[1]
}
dat, err := os.ReadFile(configFilename)
if err != nil {
logger.Fatal("failed to read config.yaml", zap.Error(err))
}