mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: remove config file requirement, fixes #435
This commit is contained in:
parent
9f38246fe2
commit
bc9132f84d
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -376,13 +375,6 @@ func readColors() map[string]map[string]string {
|
|||||||
return colors
|
return colors
|
||||||
}
|
}
|
||||||
|
|
||||||
func mustReadConfigLocation() string {
|
|
||||||
if _, err := os.Stat(*cFlag); err != nil {
|
|
||||||
logbuch.Fatal("failed to find config file at '%s'", *cFlag)
|
|
||||||
}
|
|
||||||
return *cFlag
|
|
||||||
}
|
|
||||||
|
|
||||||
func resolveDbDialect(dbType string) string {
|
func resolveDbDialect(dbType string) string {
|
||||||
if dbType == "cockroach" {
|
if dbType == "cockroach" {
|
||||||
return "postgres"
|
return "postgres"
|
||||||
@ -409,7 +401,7 @@ func Load(version string) *Config {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if err := configor.New(&configor.Config{}).Load(config, mustReadConfigLocation()); err != nil {
|
if err := configor.New(&configor.Config{}).Load(config, *cFlag); err != nil {
|
||||||
logbuch.Fatal("failed to read config: %v", err)
|
logbuch.Fatal("failed to read config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user