console

package
v2.41.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsoleFS embed.FS

Functions

func BuildConsoleRouter

func BuildConsoleRouter(templateProvider TemplateProvider, templateVersion, staticDir string, opts gin.H) (*gin.Engine, error)

func Serve

func Serve(opts *ServeOpts) error

Server console and API Server

Types

type APIServer

type APIServer struct {
	Router  *gin.Engine
	Migrate *migrate.Migrate

	Address string
	Port    string
	EC      *cli.ExecutionContext
}

func NewAPIServer

func NewAPIServer(address string, port string, ec *cli.ExecutionContext) (*APIServer, error)

func (*APIServer) GetHTTPServer

func (r *APIServer) GetHTTPServer() *http.Server

type CloudTemplateProvider added in v2.18.0

type CloudTemplateProvider struct {
	*DefaultTemplateProvider
}

func NewCloudTemplateProvider added in v2.18.0

func NewCloudTemplateProvider(basePath string, templateFileName string, consoleFs embed.FS) *CloudTemplateProvider

func (*CloudTemplateProvider) GetAssetsCDN added in v2.18.0

func (p *CloudTemplateProvider) GetAssetsCDN() string

func (*CloudTemplateProvider) GetAssetsVersion added in v2.18.0

func (p *CloudTemplateProvider) GetAssetsVersion(v *version.Version) string

type ConsoleServer

type ConsoleServer struct {
	Logger          *logrus.Logger
	Port            string
	APIPort         string
	Address         string
	DontOpenBrowser bool
	StaticDir       string
	Browser         string

	EC               *cli.ExecutionContext
	TemplateProvider TemplateProvider
	Router           *gin.Engine
}

func NewConsoleServer

func NewConsoleServer(opts *NewConsoleServerOpts) *ConsoleServer

func (*ConsoleServer) GetHTTPServer

func (c *ConsoleServer) GetHTTPServer() (*http.Server, error)

func (*ConsoleServer) Serve

func (c *ConsoleServer) Serve()

type DefaultTemplateProvider

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

DefaultTemplateProvider implements the github.com/hasura/graphl-engine/cli/pkg/templates.DefaultTemplateProvider interface

func NewDefaultTemplateProvider

func NewDefaultTemplateProvider(basePath, templateFilename string, consoleFS embed.FS) *DefaultTemplateProvider

func (*DefaultTemplateProvider) BasePath

func (p *DefaultTemplateProvider) BasePath() string

func (*DefaultTemplateProvider) DoTemplateExist

func (p *DefaultTemplateProvider) DoTemplateExist(path string) bool

DoTemplateExist returns true if an asset exists at pathk

func (*DefaultTemplateProvider) GetAssetsCDN

func (p *DefaultTemplateProvider) GetAssetsCDN() string

func (*DefaultTemplateProvider) GetAssetsVersion

func (p *DefaultTemplateProvider) GetAssetsVersion(v *version.Version) string

GetAssetsVersion returns the assets version av to be used in the console template. This function is supposed to return the following: > input -> output > dev-build -> versioned/dev-build > v1.0.0-beta.01 -> beta/v1.0 > v1.0.0-alpha.01 -> alpha/v1.0 > v1.2.1-rc.03 -> rc/v1.2 > v1.1.0 -> stable/v1.1

func (*DefaultTemplateProvider) GetTemplateVersion

func (p *DefaultTemplateProvider) GetTemplateVersion(v *version.Version) string

GetTemplateVersion returns the template version tv required to render the console html.

func (*DefaultTemplateProvider) LoadTemplates

func (p *DefaultTemplateProvider) LoadTemplates(path string, templateNames ...string) (multitemplate.Render, error)

func (*DefaultTemplateProvider) TemplateFilename

func (p *DefaultTemplateProvider) TemplateFilename() string

type EELiteTemplateProvider added in v2.18.0

type EELiteTemplateProvider struct {
	*DefaultTemplateProvider
}

func NewEETemplateProvider added in v2.18.0

func NewEETemplateProvider(basePath string, templateFileName string, consoleFs embed.FS) *EELiteTemplateProvider

func (*EELiteTemplateProvider) GetAssetsCDN added in v2.18.0

func (p *EELiteTemplateProvider) GetAssetsCDN() string

func (*EELiteTemplateProvider) GetAssetsVersion added in v2.18.0

func (p *EELiteTemplateProvider) GetAssetsVersion(v *version.Version) string

type NewConsoleServerOpts

type NewConsoleServerOpts struct {
	Logger          *logrus.Logger
	Port            string
	APIPort         string
	Address         string
	DontOpenBrowser bool
	StaticDir       string
	Browser         string

	TemplateProvider TemplateProvider
	EC               *cli.ExecutionContext
	Router           *gin.Engine
}

type ServeOpts

type ServeOpts struct {
	APIServer       *APIServer
	ConsoleServer   *ConsoleServer
	EC              *cli.ExecutionContext
	DontOpenBrowser bool
	Browser         string
	ConsolePort     string
	APIPort         string
	Address         string

	SignalChanAPIServer     chan os.Signal
	SignalChanConsoleServer chan os.Signal
}

type TemplateProvider

type TemplateProvider interface {
	// BasePath will return the basepath for the tempalate directory
	BasePath() string

	// This is the template filename eg: console.html, console2.html
	TemplateFilename() string

	// DoTemplateExist returns true if an asset exists at pathk
	DoTemplateExist(path string) bool
	LoadTemplates(path string, templateNames ...string) (multitemplate.Render, error)

	// GetTemplateVersion returns the template version tv required to render
	// the console html.
	GetTemplateVersion(v *version.Version) string
	// GetAssetsVersion returns the assets version av to be used in the
	// console template. This function is supposed to return the following:
	// > input           -> output
	// > dev-build       -> versioned/dev-build
	// > v1.0.0-beta.01  -> beta/v1.0
	// > v1.0.0-alpha.01 -> alpha/v1.0
	// > v1.2.1-rc.03    -> rc/v1.2
	// > v1.1.0          -> stable/v1.1
	GetAssetsVersion(v *version.Version) string
	GetAssetsCDN() string
}

Jump to

Keyboard shortcuts

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