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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user