Add frontend #1
@@ -21,7 +21,7 @@ func Register(app *fiber.App, cfg *config.Config, envCfg *envconfig.EnvConfig, d
|
|||||||
updateSiteHandler := handlers.NewUpdateSiteHandler(cfg, envCfg)
|
updateSiteHandler := handlers.NewUpdateSiteHandler(cfg, envCfg)
|
||||||
siteHandler := handlers.NewSiteHandler(siteRepository)
|
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.Get("/health", handlers.HealthCheck)
|
||||||
|
|
||||||
api.Post("/update", updateSiteHandler.PostUpdate)
|
api.Post("/update", updateSiteHandler.PostUpdate)
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type EnvConfig struct {
|
type EnvConfig struct {
|
||||||
Port string
|
Port string
|
||||||
ConfigDir string
|
ConfigDir string
|
||||||
GithubPat string
|
GithubPat string
|
||||||
StoragePath string
|
StoragePath string
|
||||||
ApiHost string
|
DashboardHost string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load() EnvConfig {
|
func Load() EnvConfig {
|
||||||
@@ -33,16 +33,16 @@ func Load() EnvConfig {
|
|||||||
storagePath = "./storage"
|
storagePath = "./storage"
|
||||||
}
|
}
|
||||||
|
|
||||||
apiHost := os.Getenv("API_HOST")
|
dashboardHost := os.Getenv("DASHBOARD_HOST")
|
||||||
if apiHost == "" {
|
if dashboardHost == "" {
|
||||||
apiHost = "localhost"
|
dashboardHost = "localhost"
|
||||||
}
|
}
|
||||||
|
|
||||||
return EnvConfig{
|
return EnvConfig{
|
||||||
Port: port,
|
Port: port,
|
||||||
ConfigDir: configDir,
|
ConfigDir: configDir,
|
||||||
GithubPat: githubPat,
|
GithubPat: githubPat,
|
||||||
StoragePath: storagePath,
|
StoragePath: storagePath,
|
||||||
ApiHost: apiHost,
|
DashboardHost: dashboardHost,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user