Renamed api host to dashboard host env variable

This commit is contained in:
2026-04-03 10:33:35 +02:00
parent a2e5c735a6
commit 2931729f97
2 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ func Register(app *fiber.App, cfg *config.Config, envCfg *envconfig.EnvConfig, d
updateSiteHandler := handlers.NewUpdateSiteHandler(cfg, envCfg)
siteHandler := handlers.NewSiteHandler(siteRepository)
api := app.Group("/api/v1", middleware.APIHostGuard(envCfg.ApiHost))
api := app.Group("/api/v1", middleware.APIHostGuard(envCfg.DashboardHost))
api.Get("/health", handlers.HealthCheck)
api.Post("/update", updateSiteHandler.PostUpdate)
+5 -5
View File
@@ -9,7 +9,7 @@ type EnvConfig struct {
ConfigDir string
GithubPat string
StoragePath string
ApiHost string
DashboardHost string
}
func Load() EnvConfig {
@@ -33,9 +33,9 @@ func Load() EnvConfig {
storagePath = "./storage"
}
apiHost := os.Getenv("API_HOST")
if apiHost == "" {
apiHost = "localhost"
dashboardHost := os.Getenv("DASHBOARD_HOST")
if dashboardHost == "" {
dashboardHost = "localhost"
}
return EnvConfig{
@@ -43,6 +43,6 @@ func Load() EnvConfig {
ConfigDir: configDir,
GithubPat: githubPat,
StoragePath: storagePath,
ApiHost: apiHost,
DashboardHost: dashboardHost,
}
}