first commit
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
type Config struct {
|
||||
Server ServerConfig
|
||||
GRPC GRPCConfig
|
||||
Databases map[string]DatabaseConfig
|
||||
ReadReplicas map[string][]DatabaseConfig
|
||||
Auth AuthConfig
|
||||
@@ -30,6 +31,10 @@ type Config struct {
|
||||
Validator *validator.Validate
|
||||
}
|
||||
|
||||
type GRPCConfig struct {
|
||||
Port int
|
||||
Enabled bool
|
||||
}
|
||||
type SwaggerConfig struct {
|
||||
Title string
|
||||
Description string
|
||||
@@ -200,6 +205,10 @@ func LoadConfig() *Config {
|
||||
Port: getEnvAsInt("PORT", 8080),
|
||||
Mode: getEnv("GIN_MODE", "debug"),
|
||||
},
|
||||
GRPC: GRPCConfig{
|
||||
Port: getEnvAsInt("GRPC_PORT", 50051),
|
||||
Enabled: getEnvAsBool("GRPC_ENABLED", true),
|
||||
},
|
||||
Databases: make(map[string]DatabaseConfig),
|
||||
ReadReplicas: make(map[string][]DatabaseConfig),
|
||||
Auth: loadAuthConfig(),
|
||||
@@ -237,10 +246,10 @@ func LoadConfig() *Config {
|
||||
Schemes: parseSchemes(getEnv("SWAGGER_SCHEMES", "http,https")),
|
||||
},
|
||||
Security: SecurityConfig{
|
||||
TrustedOrigins: parseOrigins(getEnv("SECURITY_TRUSTED_ORIGINS", "http://localhost:3000,http://localhost:8080")),
|
||||
TrustedOrigins: parseOrigins(getEnv("SECURITY_TRUSTED_ORIGINS", "http://localhost:3000,http://localhost,http://localhost:8080,http://10.10.150.207:3001,http://10.10.150.114:3000,http://10.10.150.175:3000,http://192.168.18.7:3001,http://localhost:3001")),
|
||||
MaxInputLength: getEnvAsInt("SECURITY_MAX_INPUT_LENGTH", 500),
|
||||
RateLimit: RateLimitConfig{
|
||||
RequestsPerMinute: getEnvAsInt("RATE_LIMIT_REQUESTS_PER_MINUTE", 60),
|
||||
RequestsPerMinute: getEnvAsInt("RATE_LIMIT_REQUESTS_PER_MINUTE", 230),
|
||||
Redis: RedisConfig{
|
||||
Host: getEnv("REDIS_HOST", "localhost"),
|
||||
Port: getEnvAsInt("REDIS_PORT", 6379),
|
||||
|
||||
Reference in New Issue
Block a user