Documentation ¶
Index ¶
- Constants
- Variables
- func GetBaseHref(routePrefix string) string
- func InjectHTMLBaseTag(html []byte, baseHref string) []byte
- func NewHandlers(ctx context.Context, log logr.Logger, cfg *Config, sm auth.SessionManager) (http.Handler, error)
- func WithRoutePrefix(mux *http.ServeMux, routePrefix string) *http.ServeMux
- type ApplicationsOption
- type ApplicationsOptions
- type Config
Constants ¶
const DefaultHost = "0.0.0.0"
const DefaultPort = "9001"
Variables ¶
var (
PublicRoutes = []string{
"/v1/featureflags",
}
)
Functions ¶
func GetBaseHref ¶ added in v0.32.0
GetBaseHref formats the baseHref for the application given the configured route prefix. Its used to set the <base href> tag in the index.html file. This in turn will form the base URL for all the assets (js, css, etc) that are loaded by the browser.
The UI is built with Parcel and has been configured to generate relative script/link tags during the build (without a leading or trailing slash) e.g. <script src="main.js">. The base href we generate here must complete the URL for these assets and so should have a leading and trailing slash, e.g. <base href="/weave-gitops/"> or <base href="/">
func InjectHTMLBaseTag ¶ added in v0.32.0
InjectHTMLBaseTag injects a <base href> tag into the provided html. This is used to set the base URL for all the assets (js, css, etc) that are loaded by the browser.
func NewHandlers ¶ added in v0.6.0
func NewHandlers(ctx context.Context, log logr.Logger, cfg *Config, sm auth.SessionManager) (http.Handler, error)
NewHandlers creates and returns a new server configured to serve the core application.
func WithRoutePrefix ¶ added in v0.32.0
WithRoutePrefix wraps the provided mux with a new mux that handles the provided route prefix. This is useful when the application is served from a subpath, e.g. /weave-gitops. The route prefix is stripped from the request before being passed to the provided mux.
We also redirect the user to the route prefix if they hit the root of the server, e.g. if they port-forward.
Types ¶
type ApplicationsOption ¶ added in v0.6.1
type ApplicationsOption func(*ApplicationsOptions)
ApplicationsOption defines the signature of a function that can be used to set an option for an ApplicationsServer.
func WithCRDFetcher ¶ added in v0.15.0
func WithCRDFetcher(fetcher crd.Fetcher) ApplicationsOption
WithCRDFetcher allows for setting a CRDFetcher.
func WithClientGetter ¶ added in v0.6.1
func WithClientGetter(clientGetter kube.ClientGetter) ApplicationsOption
WithClientGetter allows for setting a ClientGetter.
type ApplicationsOptions ¶ added in v0.6.1
type ApplicationsOptions struct { ClientGetter kube.ClientGetter CRDFetcher crd.Fetcher }
ApplicationsOptions includes all the options that can be set for an ApplicationsServer.
type Config ¶ added in v0.6.0
type Config struct { CoreServerConfig core.CoreServerConfig AuthServer *auth.AuthServer }