Add frontend #1
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user