package config import ( "os" ) type ServerConfig struct { Port string ConnectionString string } type Config struct { Server ServerConfig } func New() *Config { return &Config{ Server: ServerConfig{ Port: getEnv("PORT", "8080"), ConnectionString: getEnv("CONNECTION_STRING", "host=localhost user=astra_users password=password dbname=astra_users_db port=5432 sslmode=disable TimeZone=Europe/Moscow"), }, } } func getEnv(key string, defaultVal string) string { if value, exists := os.LookupEnv(key); exists { return value } return defaultVal } var Env = New()