server

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: GPL-3.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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 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 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, boxStatic 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 excecuted 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 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(config *resource.CmsConfig, db *sqlx.DB, cruds map[string]*resource.DbResource) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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