Documentation ¶
Overview ¶
Package config provides supporting code for multi-tenant setups
Index ¶
- func Cmd(area *Area) *cobra.Command
- func Load(root *Area, basedir string, options ...LoadOption) error
- func LoadConfigFile(area *Area, file string) error
- func TryModules(cm Map, modules ...dingo.Module) error
- type Area
- type CueConfigModule
- type DefaultConfigModule
- type LoadConfig
- type LoadOption
- type Map
- type Module
- type OverrideConfigModule
- type Route
- type Slice
- type TemplateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cmd ¶
Cmd command: The Area for which the config is to be printed need to be passed. This will be done by Dingo if a Provider is used for example.
func Load ¶
func Load(root *Area, basedir string, options ...LoadOption) error
Load configuration in basedir
func LoadConfigFile ¶
LoadConfigFile loads a config Deprecated: do not arbitrarily load anything anymore, use Area.Load
Types ¶
type Area ¶
type Area struct { Name string Parent *Area Childs []*Area Modules []dingo.Module Injector *dingo.Injector Routes []Route Configuration Map LoadedConfig Map // Deprecated: empty and should not be used anymore // contains filtered or unexported fields }
Area defines a configuration area for multi-site setups it is initialized by project main package and partly loaded by config files
func MergeFrom ¶
MergeFrom merges two Contexts into a new one We do not merge config, as we use the DI to handle it
func (*Area) Flat ¶
Flat returns a map of name->*Area of contexts, were all values have been inherited (yet overridden) of the parent context tree.
func (*Area) GetFlatContexts ¶
GetFlatContexts returns a map of context-relative-name->*Area, which has been flatted to inherit all parent's tree settings such as DI & co, and filtered to only list tree nodes specified by Contexts of area. Deprecated: just do it yourself if necessary, with Flat()
func (*Area) GetInitializedInjector ¶
GetInitializedInjector returns initialized container based on the configuration we derive our injector from our parent
func (*Area) HasConfigKey ¶
HasConfigKey checks recursive if the config has a given key
type CueConfigModule ¶ added in v3.1.0
type CueConfigModule interface {
CueConfig() string
}
CueConfigModule provides a cue schema with default configuration which is used to validate and set config
type DefaultConfigModule ¶
type DefaultConfigModule interface {
DefaultConfig() Map
}
DefaultConfigModule is used to get a module's default configuration Deprecated: use CueConfigModule instead
type LoadConfig ¶ added in v3.1.0
type LoadConfig struct {
// contains filtered or unexported fields
}
LoadConfig provides configuration for the loader
type LoadOption ¶ added in v3.1.0
type LoadOption func(*LoadConfig)
LoadOption to be passed to Load(, ...)
func AdditionalConfig ¶ added in v3.1.0
func AdditionalConfig(addtionalConfig []string) LoadOption
AdditionalConfig adds additional config values (yaml strings) to the config
func CueDebug ¶ added in v3.1.0
func CueDebug(path []string, callback func([]byte, error)) LoadOption
CueDebug enables a cue.Instance debugger. This is part of a dev-api and might change!
func DebugLog ¶ added in v3.1.0
func DebugLog(debug bool) LoadOption
DebugLog enables/disabled detailed debug logging
func LegacyMapping ¶ added in v3.1.0
func LegacyMapping(mapLegacy, logLegacy bool) LoadOption
LegacyMapping controls if flamingo legacy config mapping happens
type Module ¶
type Module struct {
Map
}
Module defines a dingo module which automatically binds provided config. Normally this module is not included in your flamingo projects bootstrap.
Its can be useful for testing dingo.Module that require certain configuration to be set before. E.g.:
cfgModule := &config.Module{ Map: config.Map{ "redirects.useInRouter": true, "redirects.useInPrefixRouter": true, }, } if err := dingo.TryModule(cfgModule, module); err != nil { t.Error(err) }
type OverrideConfigModule ¶
OverrideConfigModule allows to override config dynamically
type Route ¶
Route defines the yaml structure for a route, consisting of a path and a controller, as well as optional args
type TemplateFunc ¶
type TemplateFunc struct {
// contains filtered or unexported fields
}
TemplateFunc allows to retrieve config variables
func (*TemplateFunc) Func ¶
func (c *TemplateFunc) Func(ctx context.Context) interface{}
Func returns the template function