From 2931729f97265fdf0c25396beb9462e07021522a Mon Sep 17 00:00:00 2001 From: KartoffelChips <104089082+KartoffelChipss@users.noreply.github.com> Date: Fri, 3 Apr 2026 10:33:35 +0200 Subject: [PATCH] Renamed api host to dashboard host env variable --- app/routes/routes.go | 2 +- internal/envconfig/envconfig.go | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/routes/routes.go b/app/routes/routes.go index 753c26e..f1d0d71 100644 --- a/app/routes/routes.go +++ b/app/routes/routes.go @@ -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) diff --git a/internal/envconfig/envconfig.go b/internal/envconfig/envconfig.go index 781a8c9..6d891f8 100644 --- a/internal/envconfig/envconfig.go +++ b/internal/envconfig/envconfig.go @@ -5,11 +5,11 @@ import ( ) type EnvConfig struct { - Port string - ConfigDir string - GithubPat string - StoragePath string - ApiHost string + Port string + ConfigDir string + GithubPat string + StoragePath string + DashboardHost string } func Load() EnvConfig { @@ -33,16 +33,16 @@ 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{ - Port: port, - ConfigDir: configDir, - GithubPat: githubPat, - StoragePath: storagePath, - ApiHost: apiHost, + Port: port, + ConfigDir: configDir, + GithubPat: githubPat, + StoragePath: storagePath, + DashboardHost: dashboardHost, } }