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:
parent
e162ef04a5
commit
276b6bb923
3 changed files with 5 additions and 5 deletions
|
|
@ -31,7 +31,7 @@ CORS_ORIGINS=*
|
||||||
|
|
||||||
# Swagger Configuration
|
# Swagger Configuration
|
||||||
# Host without scheme (ex: localhost:8214 or api.saveinmed.com)
|
# 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
|
# Comma-separated list of schemes shown in Swagger UI selector
|
||||||
SWAGGER_SCHEMES=http,https
|
SWAGGER_SCHEMES=http,https
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ func main() {
|
||||||
// swagger metadata overrides
|
// swagger metadata overrides
|
||||||
docs.SwaggerInfo.Title = cfg.AppName
|
docs.SwaggerInfo.Title = cfg.AppName
|
||||||
docs.SwaggerInfo.BasePath = "/"
|
docs.SwaggerInfo.BasePath = "/"
|
||||||
if cfg.SwaggerHost != "" {
|
if cfg.BackendHost != "" {
|
||||||
docs.SwaggerInfo.Host = cfg.SwaggerHost
|
docs.SwaggerInfo.Host = cfg.BackendHost
|
||||||
}
|
}
|
||||||
if len(cfg.SwaggerSchemes) > 0 {
|
if len(cfg.SwaggerSchemes) > 0 {
|
||||||
docs.SwaggerInfo.Schemes = cfg.SwaggerSchemes
|
docs.SwaggerInfo.Schemes = cfg.SwaggerSchemes
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ type Config struct {
|
||||||
JWTExpiresIn time.Duration
|
JWTExpiresIn time.Duration
|
||||||
PasswordPepper string
|
PasswordPepper string
|
||||||
CORSOrigins []string
|
CORSOrigins []string
|
||||||
SwaggerHost string
|
BackendHost string
|
||||||
SwaggerSchemes []string
|
SwaggerSchemes []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ func Load() Config {
|
||||||
JWTExpiresIn: getEnvDuration("JWT_EXPIRES_IN", 24*time.Hour),
|
JWTExpiresIn: getEnvDuration("JWT_EXPIRES_IN", 24*time.Hour),
|
||||||
PasswordPepper: getEnv("PASSWORD_PEPPER", ""),
|
PasswordPepper: getEnv("PASSWORD_PEPPER", ""),
|
||||||
CORSOrigins: getEnvStringSlice("CORS_ORIGINS", []string{"*"}),
|
CORSOrigins: getEnvStringSlice("CORS_ORIGINS", []string{"*"}),
|
||||||
SwaggerHost: getEnv("SWAGGER_HOST", ""),
|
BackendHost: getEnv("BACKEND_HOST", ""),
|
||||||
SwaggerSchemes: getEnvStringSlice("SWAGGER_SCHEMES", []string{"http"}),
|
SwaggerSchemes: getEnvStringSlice("SWAGGER_SCHEMES", []string{"http"}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue