This commit is contained in:
ITQ
2025-12-17 17:33:02 +03:00
parent 76ceea07b7
commit af03bc2c76
18 changed files with 420 additions and 190 deletions
-10
View File
@@ -22,27 +22,17 @@ type Config struct {
DBPassword string
DBName string
RedisURI string
AuthGRPCAddr string
CacheEnabled bool
}
func Load() (*Config, error) {
_ = godotenv.Load()
return &Config{
GRPCPort: mustGetInt("GRPC_PORT", 50051), //nolint:mnd // false-positive
GRPCEnableReflection: mustGetBool("GRPC_ENABLE_REFLECTION", false),
EnableHTTPHandler: mustGetBool("HTTP_HANDLER_ENABLE", false),
HTTPPort: mustGetInt("HTTP_PORT", 8080), //nolint:mnd // false-positive
LogLevel: getEnv("LOG_LEVEL", "info"),
DBHost: getEnv("POSTGRES_HOST", "localhost"),
DBPort: mustGetInt("POSTGRES_PORT", 5432), //nolint:mnd // false-positive
DBUser: getEnv("POSTGRES_USERNAME", "postgres"),
DBPassword: getEnv("POSTGRES_PASSWORD", "postgres"),
DBName: getEnv("POSTGRES_DATABASE", "postgres"),
RedisURI: getEnv("REDIS_URI", "redis://localhost:6379"),
AuthGRPCAddr: getEnv("AUTH_GRPC_ADDR", "localhost:50052"),
CacheEnabled: mustGetBool("CACHE_ENABLED", true),
}, nil
}