feat: dynamically set swagger host, and some ui improvements on ssh page

This commit is contained in:
allanice001
2025-11-06 05:52:06 +00:00
parent 7dc7d1a1f1
commit 12f2c5e1c5
4 changed files with 40 additions and 29 deletions

View File

@@ -24,10 +24,11 @@ type Config struct {
GithubClientID string
GithubClientSecret string
UIDev bool
Env string
Debug bool
Swagger bool
UIDev bool
Env string
Debug bool
Swagger bool
SwaggerHost string
}
var (
@@ -52,6 +53,7 @@ func Load() (Config, error) {
v.SetDefault("env", "development")
v.SetDefault("debug", false)
v.SetDefault("swagger", false)
v.SetDefault("swagger.host", "localhost:8080")
// Env setup and binding
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
@@ -73,6 +75,7 @@ func Load() (Config, error) {
"env",
"debug",
"swagger",
"swagger.host",
}
for _, k := range keys {
_ = v.BindEnv(k)
@@ -92,10 +95,11 @@ func Load() (Config, error) {
GithubClientID: v.GetString("github.client.id"),
GithubClientSecret: v.GetString("github.client.secret"),
UIDev: v.GetBool("ui.dev"),
Env: v.GetString("env"),
Debug: v.GetBool("debug"),
Swagger: v.GetBool("swagger"),
UIDev: v.GetBool("ui.dev"),
Env: v.GetString("env"),
Debug: v.GetBool("debug"),
Swagger: v.GetBool("swagger"),
SwaggerHost: v.GetString("swagger.host"),
}
// Validate