refactor(backend): rename SWAGGER_HOST to BACKEND_HOST

Renames SWAGGER_HOST to BACKEND_HOST in .env.example and config. Updates main.go to use the new configuration variable.
This commit is contained in:
Tiago Yamamoto 2025-12-21 22:21:37 -03:00
parent e162ef04a5
commit 276b6bb923
3 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ CORS_ORIGINS=*
# Swagger Configuration
# Host without scheme (ex: localhost:8214 or api.saveinmed.com)
SWAGGER_HOST=localhost:8214
BACKEND_HOST=localhost:8214
# Comma-separated list of schemes shown in Swagger UI selector
SWAGGER_SCHEMES=http,https

View file

@ -30,8 +30,8 @@ func main() {
// swagger metadata overrides
docs.SwaggerInfo.Title = cfg.AppName
docs.SwaggerInfo.BasePath = "/"
if cfg.SwaggerHost != "" {
docs.SwaggerInfo.Host = cfg.SwaggerHost
if cfg.BackendHost != "" {
docs.SwaggerInfo.Host = cfg.BackendHost
}
if len(cfg.SwaggerSchemes) > 0 {
docs.SwaggerInfo.Schemes = cfg.SwaggerSchemes

View file

@ -22,7 +22,7 @@ type Config struct {
JWTExpiresIn time.Duration
PasswordPepper string
CORSOrigins []string
SwaggerHost string
BackendHost string
SwaggerSchemes []string
}
@ -42,7 +42,7 @@ func Load() Config {
JWTExpiresIn: getEnvDuration("JWT_EXPIRES_IN", 24*time.Hour),
PasswordPepper: getEnv("PASSWORD_PEPPER", ""),
CORSOrigins: getEnvStringSlice("CORS_ORIGINS", []string{"*"}),
SwaggerHost: getEnv("SWAGGER_HOST", ""),
BackendHost: getEnv("BACKEND_HOST", ""),
SwaggerSchemes: getEnvStringSlice("SWAGGER_SCHEMES", []string{"http"}),
}