config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateConfig

func GenerateConfig(configFilePath string) error

GenerateConfig started the interactive cli to generate config file

func StoreConfigToFile added in v0.10.0

func StoreConfigToFile(conf *Config, path string) error

StoreConfigToFile stores the config file to disk

Types

type Admin added in v0.10.0

type Admin struct {
	Secret    string          `json:"secret" yaml:"secret"`
	Operation OperationConfig `json:"operatiop"`
	Users     []AdminUser     `json:"users" yaml:"users"`
}

Admin stores the admin credentials

type AdminUser added in v0.10.0

type AdminUser struct {
	User   string       `json:"user" yaml:"user"`
	Pass   string       `json:"pass" yaml:"pass"`
	Scopes ProjectScope `json:"scopes" yaml:"scopes"`
}

AdminUser holds the user credentials and scope

type Auth

type Auth map[string]*AuthStub // The key here is the sign in method

Auth holds the mapping of the sign in method

type AuthStub

type AuthStub struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	ID      string `json:"id" yaml:"id"`
	Secret  string `json:"secret" yaml:"secret"`
}

AuthStub holds the config at a single sign in level

type Config

type Config struct {
	Projects []*Project `json:"projects" yaml:"projects"` // The key here is the project id
	SSL      *SSL       `json:"ssl" yaml:"ssl"`
	Admin    *Admin     `json:"admin" yaml:"admin"`
	Deploy   Deploy     `json:"deploy" yaml:"deploy"`
	Static   *Static    `json:"gateway" yaml:"gateway"`
	Cluster  string     `json:"cluster" yaml:"cluster"`
	NodeID   string     `json:"nodeId" yaml:"nodeId"`
}

Config holds the entire configuration

func GenerateEmptyConfig added in v0.10.0

func GenerateEmptyConfig() *Config

GenerateEmptyConfig creates an empty config file

func LoadConfigFromFile

func LoadConfigFromFile(path string) (*Config, error)

LoadConfigFromFile loads the config from the provided file path

type Crud

type Crud map[string]*CrudStub // The key here is the database type

Crud holds the mapping of database level configuration

type CrudStub

type CrudStub struct {
	Conn        string                `json:"conn" yaml:"conn"`
	Collections map[string]*TableRule `json:"collections" yaml:"collections"` // The key here is table name
	IsPrimary   bool                  `json:"isPrimary" yaml:"isPrimary"`
	Enabled     bool                  `json:"enabled" yaml:"enabled"`
}

CrudStub holds the config at the database level

type Deploy added in v0.10.0

type Deploy struct {
	Orchestrator utils.OrchestratorType `json:"orchestrator,omitempty" yaml:"orchestrator,omitempty"`
	Registry     Registry               `json:"registry,omitempty" yaml:"registry,omitempty"`
	Namespace    string                 `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Enabled      bool                   `json:"enabled" yaml:"enabled"`
}

Deploy holds the deployment environment config

type FileRule

type FileRule struct {
	Prefix string           `json:"prefix" yaml:"prefix"`
	Rule   map[string]*Rule `json:"rule" yaml:"rule"` // The key can be create, read, delete
}

FileRule is the authorization object at the file rule level

type FileStore

type FileStore struct {
	Enabled   bool        `json:"enabled" yaml:"enabled"`
	StoreType string      `json:"storeType" yaml:"storeType"`
	Conn      string      `json:"conn" yaml:"conn"`
	Endpoint  string      `json:"endpoint" yaml:"endpoint"`
	Bucket    string      `json:"bucket" yaml:"bucket"`
	Rules     []*FileRule `json:"rules" yaml:"rules"`
}

FileStore holds the config for the file store module

type Function added in v0.11.0

type Function struct {
	Rule *Rule `json:"rule" yaml:"rule"`
}

Function holds the config of a function

type Functions

type Functions struct {
	Enabled  bool         `json:"enabled" yaml:"enabled"`
	Broker   utils.Broker `json:"broker" yaml:"broker"`
	Conn     string       `json:"conn" yaml:"conn"`
	Services Services     `json:"services" yaml:"services"`
}

Functions holds the config for the functions module

type Modules

type Modules struct {
	Crud      Crud       `json:"crud" yaml:"crud"`
	Auth      Auth       `json:"auth" yaml:"auth"`
	Functions *Functions `json:"functions" yaml:"functions"`
	Realtime  *Realtime  `json:"realtime" yaml:"realtime"`
	FileStore *FileStore `json:"fileStore" yaml:"fileStore"`
}

Modules holds the config of all the modules of that environment

type OperationConfig added in v0.10.0

type OperationConfig struct {
	Mode   int    `json:"mode" yaml:"mode"`
	UserID string `json:"userId" yaml:"userId"`
	Key    string `json:"key" yaml:"key"`
}

OperationConfig holds the operation mode config

type Project

type Project struct {
	Secret  string   `json:"secret" yaml:"secret"`
	ID      string   `json:"id" yaml:"id"`
	Name    string   `json:"name" yaml:"name"`
	Modules *Modules `json:"modules" yaml:"modules"`
}

Project holds the project level configuration

type ProjectScope added in v0.10.0

type ProjectScope map[string][]string // (project name -> []scopes)

ProjectScope contains the project level scope

type Realtime

type Realtime struct {
	Enabled bool         `json:"enabled" yaml:"enabled"`
	Broker  utils.Broker `json:"broker" yaml:"broker"`
	Conn    string       `json:"conn" yaml:"conn"`
}

Realtime holds the config for the realtime module

type Registry added in v0.10.0

type Registry struct {
	URL   string  `json:"url" yaml:"url"`
	ID    string  `json:"id" yaml:"id"`
	Key   string  `json:"key" yaml:"key"`
	Token *string `json:"token,omitempty" yaml:"token,omitempty"`
}

Registry holds the details of the registry

type Rule

type Rule struct {
	Rule    string                 `json:"rule" yaml:"rule"`
	Eval    string                 `json:"eval,omitempty" yaml:"eval,omitempty"`
	Type    string                 `json:"type,omitempty" yaml:"type,omitempty"`
	F1      interface{}            `json:"f1,omitempty" yaml:"f1,omitempty"`
	F2      interface{}            `json:"f2,omitempty" yaml:"f2,omitempty"`
	Clauses []*Rule                `json:"clauses,omitempty" yaml:"clauses,omitempty"`
	DB      string                 `json:"db,omitempty" yaml:"db,omitempty"`
	Col     string                 `json:"col,omitempty" yaml:"col,omitempty"`
	Find    map[string]interface{} `json:"find,omitempty" yaml:"find,omitempty"`
	Service string                 `json:"service,omitempty" yaml:"service,omitempty"`
	Func    string                 `json:"func,omitempty" yaml:"func,omitempty"`
}

Rule is the authorisation object at the query level

type SSL

type SSL struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	Crt     string `json:"crt" yaml:"crt"`
	Key     string `json:"key" yaml:"key"`
}

SSL holds the certificate and key file locations

type Service added in v0.11.0

type Service struct {
	Functions map[string]Function `json:"functions" yaml:"functions"`
}

Service holds the config of service

type Services added in v0.11.0

type Services map[string]*Service

Services holds the config of services

type Static

type Static struct {
	Routes         []*StaticRoute `json:"routes" yaml:"routes"`
	InternalRoutes []*StaticRoute `json:"internalRoutes" yaml:"internalRoutes"`
}

Static holds the config for the static files module

type StaticRoute

type StaticRoute struct {
	ID        string `json:"id,omitempty" yaml:"id,omitempty"`
	Path      string `json:"path" yaml:"path"`
	URLPrefix string `json:"prefix" yaml:"prefix"`
	Host      string `json:"host" yaml:"host"`
	Proxy     string `json:"proxy" yaml:"proxy"`
	Protocol  string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
}

StaticRoute holds the config for each route

type TableRule

type TableRule struct {
	IsRealTimeEnabled bool             `json:"isRealtimeEnabled" yaml:"isRealtimeEnabled"`
	Rules             map[string]*Rule `json:"rules" yaml:"rules"` // The key here is query, insert, update or delete
}

TableRule contains the config at the collection level

Jump to

Keyboard shortcuts

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