Package ortus.boxlang.runtime.config
Class ConfigLoader
java.lang.Object
ortus.boxlang.runtime.config.ConfigLoader
This class is responsible for loading the core configuration file from the `resources` folder
and parsing it into the Configuration class.
It can also load from a custom location.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyOverride(Map.Entry<Key, Object> entry, IStruct flatConfig) Apply an override to the flattened configurationdeserializeConfig(File source) Load the config from a file source and return the raw config mapdeserializeConfig(String source) Load the config from a String path source and return the raw config mapdeserializeConfig(URL source) Load the config from a URL path source and return the raw config mapdeserializeConfig(Path source) Load the config from a path source and return the raw config mapFilter the environment variables for BoxLang specific onesstatic ConfigLoaderGet an instance of the ConfigLoaderloadCore()Load the default internal core config fileresources/config/boxlang.jsonloadFromFile(File source) Load the config from a fileloadFromFile(String source) Load the config from a String file sourceloadFromFile(URL source) Load the config from a URL file sourceloadFromFile(Path source) Load the config from a file PathloadFromMap(Map<Object, Object> configMap) Load the config from a Map of settingsloadFromMap(IStruct configMap) Load the config from a Struct of settingsloadFromResources(String configFile) Load a config file from the BoxLangresourcesfolder using the class loadermergeEnvironmentOverrides(IStruct config) Merge environment overrides with the configuration
-
Method Details
-
getInstance
Get an instance of the ConfigLoader- Returns:
- The ConfigLoader instance
-
loadCore
Load the default internal core config fileresources/config/boxlang.json- Returns:
- The parsed configuration
-
loadFromResources
Load a config file from the BoxLangresourcesfolder using the class loader- Parameters:
configFile- The path to the config file from theresourcesfolder- Returns:
- The parsed configuration
- Throws:
ConfigurationException- If the config file is not a JSON object
-
loadFromMap
Load the config from a Struct of settings- Parameters:
configMap- The configuration structure to load as a Configuration object- Returns:
- The parsed configuration
-
loadFromMap
Load the config from a Map of settings- Parameters:
configMap- The configuration Map to load as a Configuration object- Returns:
- The parsed configuration
-
loadFromFile
Load the config from a file- Parameters:
source- The source to load the configuration from- Returns:
- The parsed configuration
-
loadFromFile
Load the config from a file Path- Parameters:
source- The source to load the configuration from- Returns:
- The parsed configuration
-
loadFromFile
Load the config from a URL file source- Parameters:
source- The source to load the configuration from- Returns:
- The parsed configuration
-
loadFromFile
Load the config from a String file source- Parameters:
source- The source to load the configuration from- Returns:
- The parsed configuration
-
deserializeConfig
Load the config from a file source and return the raw config map- Parameters:
source- The source to load the configuration from- Returns:
- The raw config map as a Struct
-
deserializeConfig
Load the config from a String path source and return the raw config map- Parameters:
source- The source to load the configuration from- Returns:
- The raw config map as a Struct
-
deserializeConfig
Load the config from a URL path source and return the raw config map- Parameters:
source- The source to load the configuration from- Returns:
- The raw config map as a Struct
-
deserializeConfig
Load the config from a path source and return the raw config map- Parameters:
source- The source to load the configuration from- Returns:
- The raw config map as a Struct
-
mergeEnvironmentOverrides
Merge environment overrides with the configuration- Parameters:
config- The configuration to merge the environment overrides with
-
filterEnv
Filter the environment variables for BoxLang specific ones- Parameters:
envCollection- The environment collection to filter- Returns:
- The filtered environment
-
applyOverride
Apply an override to the flattened configuration- Parameters:
entry-flatConfig-
-