const mixinafIocConfig::ConfigProvider
afIocConfig::ConfigProvider
@
Js
Implement to provide a new source of config properties, or use one of the static methods. Instances should be contributed to ConfigSource
:
@Contribute { serviceType=ConfigSource# } Void contributeConfigSource(Configuration config) { config["appConfig"] = ConfigProvider(`myConfig.props`.toFile) }
Should you wish to use them for ordering your own providers, the default provider IDs that IocConfig contribute are:
afIocConfig.factoryDefaults
afIocConfig.envVars
afIocConfig.configFile
afIocConfig.applicationDefaults
See IocConfigModule
source for details.
- config
Returns the config properties.
- fromMap
static new fromMap(Str:Obj map)
Returns a simple
ConfigProvider
implementation that returns the given properties. May be used like a ctor:configProvider := ConfigProvider(["name":"value"])
- fromProps
static new fromProps(File file, Bool checked := true)
Returns a simple
ConfigProvider
implementation that returns properties from the given config file. May be used like a ctor:configProvider := ConfigProvider(`myConfig.props`.toFile)
An Err is thrown if
checked
istrue
and the file does not exist.