server

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2018 License: GPL-3.0 Imports: 37 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stats = stats.New()

Functions

func AddResourcesToApi2Go

func AddResourcesToApi2Go(api *api2go.API, tables []resource.TableInfo, db *sqlx.DB, ms *resource.MiddlewareSet, configStore *resource.ConfigStore) map[string]*resource.DbResource

func AddStreamsToApi2Go added in v0.4.0

func AddStreamsToApi2Go(api *api2go.API, processors []*resource.StreamProcessor, db *sqlx.DB, middlewareSet *resource.MiddlewareSet, configStore *resource.ConfigStore)

func BeginsWithCheck added in v0.6.3

func BeginsWithCheck(str string, beginsWith string) bool

func BuildMiddlewareSet

func BuildMiddlewareSet(cmsConfig *resource.CmsConfig) resource.MiddlewareSet

func CheckSystemSecrets added in v0.2.1

func CheckSystemSecrets(store *resource.ConfigStore) error

func CleanUpConfigFiles

func CleanUpConfigFiles()

func CorsMiddlewareFunc

func CorsMiddlewareFunc(c *gin.Context)

func CreateApiBlueprintHandler added in v0.2.1

func CreateApiBlueprintHandler(initConfig *resource.CmsConfig, cruds map[string]*resource.DbResource) func(ctx *gin.Context)

func CreateConfigHandler

func CreateConfigHandler(configStore *resource.ConfigStore) func(context *gin.Context)

func CreateEventHandler

func CreateEventHandler(initConfig *resource.CmsConfig, fsmManager resource.FsmManager, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func CreateEventStartHandler

func CreateEventStartHandler(fsmManager resource.FsmManager, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func CreateJsModelHandler

func CreateJsModelHandler(initConfig *resource.CmsConfig) func(*gin.Context)

func CreateMetaHandler added in v0.4.0

func CreateMetaHandler(initConfig *resource.CmsConfig) func(*gin.Context)

func CreateReclineModelHandler added in v0.4.0

func CreateReclineModelHandler() func(*gin.Context)

func CreateStatsHandler added in v0.6.2

func CreateStatsHandler(initConfig *resource.CmsConfig, cruds map[string]*resource.DbResource) func(*gin.Context)

func CreateSubSiteContentHandler added in v0.2.1

func CreateSubSiteContentHandler(initConfig *resource.CmsConfig, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func CreateSubSiteSaveContentHandler added in v0.2.1

func CreateSubSiteSaveContentHandler(initConfig *resource.CmsConfig, cruds map[string]*resource.DbResource, db *sqlx.DB) func(context *gin.Context)

func EndsWith added in v0.2.1

func EndsWith(str string, endsWith string) (string, bool)

func EndsWithCheck added in v0.2.1

func EndsWithCheck(str string, endsWith string) bool

func GetActionPerformers

func GetActionPerformers(initConfig *resource.CmsConfig, configStore *resource.ConfigStore) []resource.ActionPerformerInterface

func GetDbConnection added in v0.2.1

func GetDbConnection(dbType string, connectionString string) (*sqlx.DB, error)

func GetFilePath added in v0.2.1

func GetFilePath(sourceRoot string, path string) (string, bool)

func GetStreamProcessors added in v0.4.0

func GetStreamProcessors(config *resource.CmsConfig, store *resource.ConfigStore, cruds map[string]*resource.DbResource) []*resource.StreamProcessor

func GetSubSiteFromContext added in v0.2.1

func GetSubSiteFromContext(context *gin.Context, siteMap map[string]resource.SubSiteInformation) (resource.SubSiteInformation, bool)

func GetTablesFromWorld

func GetTablesFromWorld(db *sqlx.DB) ([]resource.TableInfo, error)

func Main

func Main(boxRoot, assetsStatic http.FileSystem, db *sqlx.DB, wg *sync.WaitGroup, l net.Listener, ch chan struct{})

func MergeTables added in v0.6.4

func MergeTables(existingTables []resource.TableInfo, initConfigTables []resource.TableInfo) []resource.TableInfo

func NewStaticFsWithDefaultIndex added in v0.6.5

func NewStaticFsWithDefaultIndex(system http.Dir, pageOn404 string) http.FileSystem

func NewSubPathFs added in v0.6.4

func NewSubPathFs(system http.FileSystem, s string) http.FileSystem

Types

type CorsInfo

type CorsInfo struct {
	IsCors      bool
	IsPreflight bool
	Origin      string
	OriginUrl   *url.URL

	// The header value is converted to uppercase to avoid common mistakes.
	AccessControlRequestMethod string

	// The header values are normalized with http.CanonicalHeaderKey.
	AccessControlRequestHeaders []string
}

type CorsMiddleware

type CorsMiddleware struct {

	// Reject non CORS requests if true. See CorsInfo.IsCors.
	RejectNonCorsRequests bool

	// Function executed for every CORS requests to validate the Origin. (Required)
	// Must return true if valid, false if invalid.
	// For instance: simple equality, regexp, DB lookup, ...
	OriginValidator func(origin string, request *http.Request) bool

	// List of allowed HTTP methods. Note that the comparison will be made in
	// uppercase to avoid common mistakes. And that the
	// Access-Control-Allow-Methods response header also uses uppercase.
	// (see CorsInfo.AccessControlRequestMethod)
	AllowedMethods []string

	// List of allowed HTTP Headers. Note that the comparison will be made with
	// noarmalized names (http.CanonicalHeaderKey). And that the response header
	// also uses normalized names.
	// (see CorsInfo.AccessControlRequestHeaders)
	AllowedHeaders []string

	// List of headers used to set the Access-Control-Expose-Headers header.
	AccessControlExposeHeaders []string

	// User to se the Access-Control-Allow-Credentials response header.
	AccessControlAllowCredentials bool

	// Used to set the Access-Control-Max-Age response header, in seconds.
	AccessControlMaxAge int
	// contains filtered or unexported fields
}

CorsMiddleware provides a configurable CORS implementation.

type ErrorResponse added in v0.6.2

type ErrorResponse struct {
	Message string
}

type GrapeAsset added in v0.2.1

type GrapeAsset struct {
	Src           string `json:"src"`
	Type          string `json:"type"`
	UnitDimension string `json:"unitDim"`
	Height        int    `json:"height"`
	Width         int    `json:"width"`
}

func NewImageGrapeAsset added in v0.2.1

func NewImageGrapeAsset(src string) GrapeAsset

func NewScriptGrapeAsset added in v0.2.1

func NewScriptGrapeAsset(src string) GrapeAsset

func NewStyleGrapeAsset added in v0.2.1

func NewStyleGrapeAsset(src string) GrapeAsset

type GrapeSaveRequest added in v0.2.1

type GrapeSaveRequest struct {
	Css    string       `json:"gjs-css"`
	Assets []GrapeAsset `json:"gjs-assets"`
	Html   string       `json:"gjs-html"`
}

type HostSwitch added in v0.2.1

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

func CreateSubSites added in v0.2.1

func CreateSubSites(cmsConfig *resource.CmsConfig, db *sqlx.DB, cruds map[string]*resource.DbResource, authMiddleware *auth.AuthMiddleware) HostSwitch

func (HostSwitch) ServeHTTP added in v0.2.1

func (hs HostSwitch) ServeHTTP(w http.ResponseWriter, r *http.Request)

Implement the ServerHTTP method on our new type

type JsModel

type JsModel struct {
	ColumnModel           map[string]interface{}
	Actions               []resource.Action
	StateMachines         []map[string]interface{}
	IsStateMachineEnabled bool
}

type JsonApiError added in v0.2.1

type JsonApiError struct {
	Message string
}

type JsonApiRelation

type JsonApiRelation struct {
	JsonApi    string `json:"jsonApi,omitempty"`
	ColumnType string `json:"columnType"`
	Type       string `json:"type,omitempty"`
	ColumnName string `json:"ColumnName"`
}

func NewJsonApiRelation

func NewJsonApiRelation(name string, relationName string, relationType string, columnType string) JsonApiRelation

type StaticFsWithDefaultIndex added in v0.6.5

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

func (*StaticFsWithDefaultIndex) Open added in v0.6.5

func (spf *StaticFsWithDefaultIndex) Open(name string) (http.File, error)

type SubPathFs added in v0.6.4

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

func (*SubPathFs) Open added in v0.6.4

func (spf *SubPathFs) Open(name string) (http.File, error)

type WebSocketConnectionHandlerImpl added in v0.6.2

type WebSocketConnectionHandlerImpl struct {
}

func (*WebSocketConnectionHandlerImpl) MessageFromClient added in v0.6.2

func (wsch *WebSocketConnectionHandlerImpl) MessageFromClient(message websockets.WebSocketPayload, request *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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