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, } }