1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: define flags on init

chore: remove deprecated config files
This commit is contained in:
Ferdinand Mütsch
2020-10-04 11:47:03 +02:00
parent 29619f09ed
commit b378597594
3 changed files with 9 additions and 28 deletions

View File

@ -20,7 +20,10 @@ const (
defaultEnvConfigPathLegacy = ".env"
)
var cfg *Config
var (
cfg *Config
cFlag *string
)
type appConfig struct {
CleanUp bool `default:"false" env:"WAKAPI_CLEANUP"`
@ -60,6 +63,11 @@ type Config struct {
Server serverConfig
}
func init() {
cFlag = flag.String("c", defaultConfigPath, "config file location")
flag.Parse()
}
func (c *Config) IsDev() bool {
return IsDev(c.Env)
}
@ -157,10 +165,6 @@ func readLanguageColors() map[string]string {
}
func mustReadConfigLocation() string {
var cFlag = flag.String("c", defaultConfigPath, "config file location")
flag.Parse()
if _, err := os.Stat(*cFlag); err != nil {
log.Fatalf("failed to find config file at '%s'\n", *cFlag)
}