feat: initpage com sync Go + auth + frontend em web/
This commit is contained in:
34
internal/config/config.go
Normal file
34
internal/config/config.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port string
|
||||
BasePath string
|
||||
AppOrigin string
|
||||
SessionSecret string
|
||||
TurnstileSecret string
|
||||
TurnstileSiteKey string
|
||||
DBPath string
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
return &Config{
|
||||
Port: getEnv("PORT", "8080"),
|
||||
BasePath: getEnv("BASE_PATH", "/initpage"),
|
||||
AppOrigin: getEnv("APP_ORIGIN", "https://apps.weltonmoura.com.br"),
|
||||
SessionSecret: getEnv("SESSION_SECRET", "dev-secret-change-me"),
|
||||
TurnstileSecret: getEnv("TURNSTILE_SECRET", ""),
|
||||
TurnstileSiteKey: getEnv("TURNSTILE_SITEKEY", ""),
|
||||
DBPath: getEnv("DB_PATH", "./data/initpage.db"),
|
||||
}
|
||||
}
|
||||
|
||||
func getEnv(key, def string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
return def
|
||||
}
|
||||
Reference in New Issue
Block a user