@@ -10,36 +10,32 @@ import (
1010type Config struct {
1111 AppEnv string
1212 Port string
13- DBConnection string // connection string
13+ DBConnection string
1414 JWTSecret string
1515 EncryptionKey string
1616 CookieSecure bool
1717 BuildDir string
18- TraefikConfigDir string // Directory for Traefik dynamic config files
18+ TraefikConfigDir string
1919}
2020
2121func Load () * Config {
2222 godotenv .Load ()
2323
2424 appEnv := getEnv ("APP_ENV" , "development" )
2525
26- // Database config - SQLite only
27- dbConnection := getEnv ("DB_CONNECTION" , getDBConnectionDefault ())
28-
2926 // Always require secrets (generated by install script)
3027 jwtSecret := requireEnv ("JWT_SECRET" , "min 32 characters" )
3128 encryptionKey := requireEnv ("ENCRYPTION_KEY" , "exactly 32 characters" )
32- cookieSecure := getEnvBool ("COOKIE_SECURE" , appEnv == "production" )
3329
3430 return & Config {
3531 AppEnv : appEnv ,
36- Port : getEnv ( "PORT" , " 8090") ,
37- DBConnection : dbConnection ,
32+ Port : " 8090" ,
33+ DBConnection : getDBConnectionDefault () ,
3834 JWTSecret : jwtSecret ,
3935 EncryptionKey : encryptionKey ,
40- CookieSecure : cookieSecure ,
41- BuildDir : getEnv ( "BUILD_DIR" , " /tmp/deeploy-builds") ,
42- TraefikConfigDir : getEnv ( "TRAEFIK_CONFIG_DIR" , " /traefik/dynamic") ,
36+ CookieSecure : appEnv == "production" ,
37+ BuildDir : " /tmp/deeploy-builds" ,
38+ TraefikConfigDir : " /traefik/dynamic" ,
4339 }
4440}
4541
@@ -59,20 +55,6 @@ func getEnv(key, fallback string) string {
5955 return value
6056}
6157
62- func getEnvBool (key string , fallback bool ) bool {
63- value , exists := os .LookupEnv (key )
64- if ! exists || value == "" {
65- return fallback
66- }
67- if value == "1" || value == "true" || value == "TRUE" || value == "True" {
68- return true
69- }
70- if value == "0" || value == "false" || value == "FALSE" || value == "False" {
71- return false
72- }
73- return fallback
74- }
75-
7658func requireEnv (key , hint string ) string {
7759 value := os .Getenv (key )
7860 if value == "" {
0 commit comments