22 lines
419 B
Go
22 lines
419 B
Go
package config
|
|
|
|
import "os"
|
|
|
|
type Config struct {
|
|
DatabaseURL string
|
|
RedisURL string
|
|
}
|
|
|
|
func Load() Config {
|
|
return Config{
|
|
DatabaseURL: getenv("DATABASE_URL", "postgres://alt:alt@localhost:5432/alt?sslmode=disable"),
|
|
RedisURL: getenv("REDIS_URL", "redis://localhost:6379/0"),
|
|
}
|
|
}
|
|
|
|
func getenv(key, fallback string) string {
|
|
if value := os.Getenv(key); value != "" {
|
|
return value
|
|
}
|
|
return fallback
|
|
}
|