package config import ( "os" ) type ( Config struct { DbUrl string ListenAddr string LogLevel string MatrixIdentityServer string MatrixMsc3575Address string MatrixWellKnownAddress string } ) func GetConfig() Config { return Config{ DbUrl: getEnv("DATABASE_URL", "postgres://user:password@127.0.0.1:5432/db?sslmode=disable"), ListenAddr: getEnv("LISTEN_ADDR", ":8090"), LogLevel: getEnv("LOG_LEVEL", "INFO"), MatrixIdentityServer: getEnv("MATRIX_IDENTITY_SERVER", ""), MatrixMsc3575Address: getEnv("MATRIX_MSC3575_ADDRESS", ""), MatrixWellKnownAddress: getEnv("MATRIX_WELL_KNOWN_ADDRESS", ""), } } func getEnv(key, fallback string) string { if value, ok := os.LookupEnv(key); ok { return value } return fallback }