@@ -41,28 +41,34 @@ func setupRoutes(ctx context.Context, cfg *config.Config, authChecker auth.Check
41
41
})
42
42
})
43
43
44
- // Server status
44
+ // Server status and config
45
45
api .HandleFunc ("/status" , h .Status (ctx ))
46
+ api .HandleFunc ("/frontend-config" , h .GetFrontendConfig ())
46
47
47
- // Loki endpoints
48
- api .HandleFunc ("/loki/ready" , h .LokiReady ())
49
- api .HandleFunc ("/loki/metrics" , forceCheckAdmin (authChecker , h .LokiMetrics ()))
50
- api .HandleFunc ("/loki/buildinfo" , forceCheckAdmin (authChecker , h .LokiBuildInfos ()))
51
- api .HandleFunc ("/loki/config/limits" , forceCheckAdmin (authChecker , h .LokiLimits ()))
52
- api .HandleFunc ("/loki/flow/records" , h .GetFlows (ctx ))
53
- api .HandleFunc ("/loki/export" , h .ExportFlows (ctx ))
48
+ if cfg .Static {
49
+ // Expose static files only
50
+ r .PathPrefix ("/" ).Handler (http .FileServer (http .Dir ("./web/dist/static" )))
51
+ } else {
52
+ // Loki endpoints
53
+ api .HandleFunc ("/loki/ready" , h .LokiReady ())
54
+ api .HandleFunc ("/loki/metrics" , forceCheckAdmin (authChecker , h .LokiMetrics ()))
55
+ api .HandleFunc ("/loki/buildinfo" , forceCheckAdmin (authChecker , h .LokiBuildInfos ()))
56
+ api .HandleFunc ("/loki/config/limits" , forceCheckAdmin (authChecker , h .LokiLimits ()))
57
+ api .HandleFunc ("/loki/flow/records" , h .GetFlows (ctx ))
58
+ api .HandleFunc ("/loki/export" , h .ExportFlows (ctx ))
54
59
55
- // Common endpoints
56
- api .HandleFunc ("/flow/metrics" , h .GetTopology (ctx ))
57
- api .HandleFunc ("/resources/clusters" , h .GetClusters (ctx ))
58
- api .HandleFunc ("/resources/udns" , h .GetUDNs (ctx ))
59
- api .HandleFunc ("/resources/zones" , h .GetZones (ctx ))
60
- api .HandleFunc ("/resources/namespaces" , h .GetNamespaces (ctx ))
61
- api .HandleFunc ("/resources/names" , h .GetNames (ctx ))
60
+ // Common endpoints
61
+ api .HandleFunc ("/flow/metrics" , h .GetTopology (ctx ))
62
+ api .HandleFunc ("/resources/clusters" , h .GetClusters (ctx ))
63
+ api .HandleFunc ("/resources/udns" , h .GetUDNs (ctx ))
64
+ api .HandleFunc ("/resources/zones" , h .GetZones (ctx ))
65
+ api .HandleFunc ("/resources/namespaces" , h .GetNamespaces (ctx ))
66
+ api .HandleFunc ("/resources/names" , h .GetNames (ctx ))
67
+
68
+ // Frontend files
69
+ r .PathPrefix ("/" ).Handler (http .FileServer (http .Dir ("./web/dist/" )))
70
+ }
62
71
63
- // Frontend files
64
- api .HandleFunc ("/frontend-config" , h .GetFrontendConfig ())
65
- r .PathPrefix ("/" ).Handler (http .FileServer (http .Dir ("./web/dist/" )))
66
72
return r
67
73
}
68
74
0 commit comments