Documentation
¶
Overview ¶
Package dvconfig manages configuration for http server MicroCore Copyright 2020 - 2022 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com)
Index ¶
- Variables
- func FindAndReadConfigs(configName string, propertiesName string) string
- func ProcessBaseFolder(server *DvHostServer, hostServers []DvHostServer)
- func ProvideServerCommand()
- func ResetNamespaceFolder()
- func SaveConfig(place string, cf *DvConfig)
- func ServerStart()
- func ServerStartByConfig(cf *DvConfig)
- func SetApplicationName(name string)
- type DvConfig
- type DvHostServer
- type DvRewrite
- type ProxyServerInfo
- type ServerSession
Constants ¶
This section is empty.
Variables ¶
var CurrentDir string
CurrentDir is a current folder where the application started
var GlobalProperties map[string]string
GlobalProperties stores initial properties from environment and properties files
var LogConfig bool
LogConfig specifies whether message from package dvconfig must be logged
var MicroCoreConfig = "MicroCore.conf"
MicroCoreConfig is the config file name for http server, which can be customized by application
var MicroCoreNameSpace = "MICRO_CORE_CURRENT_NAMESPACE"
MicroCoreNameSpace is an environment variable name to specify the namespace, which is used for creation a folder inside the global work folder
var MicroCorePath = "MICRO_CORE_PATH"
MicroCorePath is an environment variable name to specify a folder where config and other info is stored
Functions ¶
func FindAndReadConfigs ¶
FindAndReadConfigs finds the config by config name and properties file starting with the current folder
func ProcessBaseFolder ¶
func ProcessBaseFolder(server *DvHostServer, hostServers []DvHostServer)
ProcessBaseFolder sets up the http server using information for all requested servers
func ProvideServerCommand ¶
func ProvideServerCommand()
ProvideServerCommand registers the http server as server for command execution purposes
func ResetNamespaceFolder ¶
func ResetNamespaceFolder()
ResetNamespaceFolder is used to change the current namespace
func SaveConfig ¶
SaveConfig saves the already-read config for the test purposes
func ServerStart ¶
func ServerStart()
ServerStart starts http server, the config and properties are read from the current folder or by other options
func ServerStartByConfig ¶
func ServerStartByConfig(cf *DvConfig)
ServerStartByConfig starts http server by the config provided as parameters
func SetApplicationName ¶
func SetApplicationName(name string)
SetApplicationName allows to customize all config names, property file names and variable prefixes
Types ¶
type DvConfig ¶
type DvConfig struct { Namespace string `json:"namespace"` Listen []string `json:"listen"` RootFolder string `json:"rootFolder"` LogLevel string `json:"logLevel"` LogModules string `json:"logModules"` Hosts []dvcom.IpList `json:"hosts"` HostServers []DvHostServer `json:"hostServers"` SystemInfo string `json:"systemInfo"` Server DvHostServer `json:"server"` Modules map[string]map[string]string `json:"modules"` Hooks map[string]map[string]string `json:"hooks"` Processors map[string]map[string]string `json:"processors"` PostProcessors map[string]map[string]string `json:"postProcessors"` Providers map[string]map[string]string `json:"providers"` ParallelProcessing *dvcontext.ParallelProcessing `json:"parallel_processing"` Dbs []*dvcontext.DatabaseConfig `json:"dbs"` }
DvConfig is a full structure of the config for http server
func ReadConfig ¶
func ReadConfig() *DvConfig
ReadConfig reads the config and properties by default names for http server
type DvHostServer ¶
type DvHostServer struct { Hosts string `json:"hosts"` BaseFolder string `json:"baseFolder"` Actions []*dvcontext.DvAction `json:"actions"` Rewrites []DvRewrite `json:"rewrites"` DefaultProxyServer string `json:"defaultProxy"` ProxyServers []ProxyServerInfo `json:"proxyServers"` ProxyServerMap map[string]string `json:"proxyServerMap"` ProxyServerSettings dvcontext.ServerSettings `json:"proxyServerSettings"` ServerRewrites []DvRewrite `json:"serverRewrites"` ProxyName string `json:"proxyName"` DomainName string `json:"domain"` CacheControl string `json:"cacheControl"` DirectoryIndex string `json:"directoryIndex"` HeadersStatic map[string]string `json:"headersStatic"` HeadersProxyServer map[string]string `json:"headersProxyServer"` HeadersStaticOptions map[string]string `json:"headersStaticOptions"` HeadersProxyServerOptions map[string]string `json:"headersProxyServerOptions"` AccessControlAllowOrigin string `json:"accessControlAllowOrigin"` AccessControlAllowMethod string `json:"accessControlAllowMethod"` AccessControlAllowHeaders string `json:"accessControlAllowHeaders"` AccessControlMaxAge string `json:"accessControlMaxAge"` AccessControlExposeHeaders string `json:"accessControlExposeHeaders"` AccessControlAllowCredentials string `json:"accessControlAllowCredentials"` Modules []dvmodules.ModuleConfig `json:"modules"` Processors []dvprocessors.ProcessorConfig `json:"processors"` PostProcessors []dvprocessors.ProcessorConfig `json:"postProcessors"` Providers []dvproviders.ProviderConfig `json:"providers"` HostHeader string `json:"hostHeader"` SecurityInfo *dvcontext.SecurityServerInfo `json:"security"` ActionPolicies map[string]*dvcontext.ActionPolicy `json:"action_policies"` LogLevel string `json:"logLevel"` DynamicActions bool `json:"dynamic"` Session *ServerSession `json:"session"` UrlIncludeOption int `json:"urlIncludeOption"` }
DvHostServer collects all parameters for a specific host server
type DvRewrite ¶
type DvRewrite struct { From string `json:"from"` To string `json:"to"` Condition string `json:"condition"` Options string `json:"options"` }
DvRewrite describes the url rewriting parameters