fix: allow load config file
This commit is contained in:
10
main.go
10
main.go
@@ -15,9 +15,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Get root path
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
cfg, err := config.LoadConfig(path.Join(path.Dir(filename), "configs", "app.yml"))
|
||||
cfgFile := os.Getenv("CONFIG_FILE")
|
||||
if cfgFile == "" {
|
||||
// Get root path
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
cfgFile = path.Join(path.Dir(filename), "configs", "app.yml")
|
||||
}
|
||||
cfg, err := config.LoadConfig(cfgFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading config: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user