Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RuntimeConfig ¶
type RuntimeConfig struct {
AuthProviderURL string `json:"authProviderURL"`
OverviewURL string `json:"overviewURL,omitempty"`
}
RuntimeConfig is injected into the served index.html as a nested global `window.ethpandaops.buildoor.config` so the SPA can read it synchronously at boot — no extra round-trip to the backend.
type SPAHandler ¶
type SPAHandler struct {
// contains filtered or unexported fields
}
SPAHandler serves a React single-page application. It serves static files when they exist, otherwise falls back to index.html for client-side routing.
func NewSPAHandler ¶
func NewSPAHandler(logger logrus.FieldLogger, staticEmbedFS fs.FS, runtimeConfig RuntimeConfig, headInjectHTML string) (*SPAHandler, error)
NewSPAHandler creates a new SPA handler. The runtimeConfig is encoded into a small <script> block injected into the <head> of index.html before any other script runs. headInjectHTML is an optional raw HTML snippet (typically custom <script>/<meta>/<link> tags from a deployment env var) injected after the runtime config so it can read it.
func NewSPAHandlerWithIndex ¶
func NewSPAHandlerWithIndex(logger logrus.FieldLogger, rootFS fs.FS, indexFilename string, runtimeConfig RuntimeConfig, headInjectHTML string) (*SPAHandler, error)
NewSPAHandlerWithIndex creates an SPA handler from an already-rooted FS (e.g. one that has already had fs.Sub applied) and a custom index filename. The overview command uses this to serve overview.html from the same static bundle.
func (*SPAHandler) ServeHTTP ¶
func (h *SPAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.