Documentation
¶
Index ¶
- Variables
- func DisableFileImports(srv *PlaygroundServer, next http.Handler) http.HandlerFunc
- func HandleAssets(pattern string, fsHandler http.Handler) http.Handler
- type PlaygroundServer
- func (srv *PlaygroundServer) HandleCreateShare() http.HandlerFunc
- func (srv *PlaygroundServer) HandleFormat() http.HandlerFunc
- func (srv *PlaygroundServer) HandleGetShare() http.HandlerFunc
- func (srv *PlaygroundServer) HandleRun() http.HandlerFunc
- func (srv *PlaygroundServer) HandleShare() http.HandlerFunc
- func (srv *PlaygroundServer) HandleVersions() http.HandlerFunc
- func (srv *PlaygroundServer) Health() http.HandlerFunc
- func (srv *PlaygroundServer) Routes() error
- func (srv *PlaygroundServer) Serve() error
Constants ¶
This section is empty.
Variables ¶
var ( // kubecfg as a library does not show the tagged build version, instead it // shows as "(dev build)". For now, this can be updated manually on occasional // bumps. KubecfgVersion = "v0.34.3" VersionResponse = []byte(fmt.Sprintf("jsonnet: %s kubecfg: %s", jsonnet.Version(), KubecfgVersion)) )
Functions ¶
func DisableFileImports ¶
func DisableFileImports(srv *PlaygroundServer, next http.Handler) http.HandlerFunc
Middleware to stop Jsonnet snippets which contain file:///, typically paired with an import, being used and becoming shareable. These are rejected before running through the Jsonnet VM and a generic error is displayed.
Types ¶
type PlaygroundServer ¶
The playground server
func New ¶
func New(state *state.State) *PlaygroundServer
func (*PlaygroundServer) HandleCreateShare ¶
func (srv *PlaygroundServer) HandleCreateShare() http.HandlerFunc
HandleCreateShare is used to create shared snippets. This is handled through creating a hash of the input and adding it to the state store - this storage mechanism is ephemeral.
At a later date, this will include a persistence layer.
func (*PlaygroundServer) HandleFormat ¶
func (srv *PlaygroundServer) HandleFormat() http.HandlerFunc
Format the input Jsonnet according to the standard jsonnetfmt rules.
func (*PlaygroundServer) HandleGetShare ¶
func (srv *PlaygroundServer) HandleGetShare() http.HandlerFunc
HandleGetShare attempts to retrieve a shared snippet hash from the internal store. If this does not exist, an error is displayed.
func (*PlaygroundServer) HandleRun ¶
func (srv *PlaygroundServer) HandleRun() http.HandlerFunc
HandleRun receives Jsonnet input via text and evaluates it.
func (*PlaygroundServer) HandleShare ¶
func (srv *PlaygroundServer) HandleShare() http.HandlerFunc
HandleShare is the rendering of the shared snippet view.
func (*PlaygroundServer) HandleVersions ¶
func (srv *PlaygroundServer) HandleVersions() http.HandlerFunc
Retrieve the current version of Jsonnet/Kubecfg in use for the running application. This is purely informational for the frontend.
func (*PlaygroundServer) Health ¶
func (srv *PlaygroundServer) Health() http.HandlerFunc
Health indicates whether the server is running.
func (*PlaygroundServer) Routes ¶
func (srv *PlaygroundServer) Routes() error
Load the available routes for the server
func (*PlaygroundServer) Serve ¶
func (srv *PlaygroundServer) Serve() error
Serve will listen on the provided address, running the server.