diff --git a/.env.example b/.env.example deleted file mode 100644 index 66d27c2..0000000 --- a/.env.example +++ /dev/null @@ -1,8 +0,0 @@ -ENV=dev -WAKAPI_DB_TYPE=sqlite3 # mysql, postgres, sqlite3 -WAKAPI_DB_NAME=wakapi_db.db # database name for mysql / postgres or file path for sqlite (e.g. /tmp/wakapi.db) -WAKAPI_DB_USER=myuser # ignored when using sqlite -WAKAPI_DB_PASSWORD=shhh # ignored when using sqlite -WAKAPI_DB_HOST=localhost # ignored when using sqlite -WAKAPI_DB_PORT=3306 # ignored when using sqlite -WAKAPI_PASSWORD_SALT=shhh # CHANGE ! \ No newline at end of file diff --git a/config.ini b/config.ini deleted file mode 100644 index 187169c..0000000 --- a/config.ini +++ /dev/null @@ -1,15 +0,0 @@ -[server] -listen = 127.0.0.1 -port = 3000 -base_path = / -insecure_cookies = false - -[app] -cleanup = false - -[database] -max_connections = 2 - -[languages] -vue = Vue -jsx = JSX \ No newline at end of file diff --git a/config/config.go b/config/config.go index dd6ec67..44edf4f 100644 --- a/config/config.go +++ b/config/config.go @@ -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) }