router

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMethodMiddleware added in v0.0.4

func CORSMethodMiddleware(r *mux.Router) mux.MiddlewareFunc

CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header

func GetRootCmd

func GetRootCmd(args []string) *cobra.Command

GetRootCmd returns the root of the cobra command-tree.

func LogMiddleware added in v0.0.4

func LogMiddleware(r *mux.Router) mux.MiddlewareFunc

LogMiddleware automatically sets the Access-Control-Allow-Methods response header

func RegisterStaticHandler added in v0.0.4

func RegisterStaticHandler(r *mux.Router, qOpts *QueryOptions)

RegisterStaticHandler adds handler for static assets to the router.

func VersionCommand added in v0.0.4

func VersionCommand() *cobra.Command

Types

type QueryOptions added in v0.0.4

type QueryOptions struct {
	// FileDir static file dir (/opt/solar-mesh/dist)
	FileDir string
	// BasePath is the prefix for all UI and API HTTP routes
	BasePath string
	// StaticAssets is the path for the static assets for the UI
	StaticAssets string
	// AdditionalHeaders
	AdditionalHeaders  http.Header
	MaxClockSkewAdjust time.Duration
}

QueryOptions holds configuration for query service

type Root

type Root struct {
	Port       int32
	FileDir    string
	Path       string
	PublicPath string
	IsGzip     bool
	Config     string
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(root *Root) *Server

func (*Server) Run

func (s *Server) Run()

type StaticAssetsHandler added in v0.0.4

type StaticAssetsHandler struct {
	// contains filtered or unexported fields
}

StaticAssetsHandler handles static assets

func NewStaticAssetsHandler added in v0.0.4

func NewStaticAssetsHandler(staticAssetsRoot string, options StaticAssetsHandlerOptions) (*StaticAssetsHandler, error)

NewStaticAssetsHandler returns a StaticAssetsHandler

func (*StaticAssetsHandler) RegisterRoutes added in v0.0.4

func (sH *StaticAssetsHandler) RegisterRoutes(router *mux.Router)

RegisterRoutes registers routes for this handler on the given router

func (*StaticAssetsHandler) StaticRegisterRoutes added in v0.0.5

func (sH *StaticAssetsHandler) StaticRegisterRoutes(router *mux.Router)

StaticRegisterRoutes registers routes for this handler on the given router

type StaticAssetsHandlerOptions added in v0.0.4

type StaticAssetsHandlerOptions struct {
	// FileDir static file dir (/opt/solar-mesh/dist)
	FileDir  string
	BasePath string
	IsGzip   bool
}

StaticAssetsHandlerOptions defines options for NewStaticAssetsHandler

type StaticRouter added in v0.0.5

type StaticRouter struct {
	FileDir    string `yaml:"file_dir,omitempty" json:"file_dir,omitempty"`
	Path       string `yaml:"path,omitempty" json:"path,omitempty"`
	PublicPath string `json:"public_path,omitempty" yaml:"public_path,omitempty"`
	IsGzip     bool   `json:"is_gzip,omitempty" yaml:"is_gzip,omitempty"`
}

type StaticServerConfig added in v0.0.5

type StaticServerConfig struct {
	Routers []*StaticRouter `yaml:"routers,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL