Class ConfigLoader

java.lang.Object
ortus.boxlang.runtime.config.ConfigLoader

public class ConfigLoader extends Object
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 Details

    • getInstance

      public static ConfigLoader getInstance()
      Get an instance of the ConfigLoader
      Returns:
      The ConfigLoader instance
    • loadCore

      public Configuration loadCore()
      Load the default internal core config file resources/config/boxlang.json
      Returns:
      The parsed configuration
    • loadFromResources

      public Configuration loadFromResources(String configFile)
      Load a config file from the BoxLang resources folder using the class loader
      Parameters:
      configFile - The path to the config file from the resources folder
      Returns:
      The parsed configuration
      Throws:
      ConfigurationException - If the config file is not a JSON object
    • loadFromMap

      public Configuration loadFromMap(IStruct configMap)
      Load the config from a Struct of settings
      Parameters:
      configMap - The configuration structure to load as a Configuration object
      Returns:
      The parsed configuration
    • loadFromMap

      public Configuration loadFromMap(Map<Object,Object> configMap)
      Load the config from a Map of settings
      Parameters:
      configMap - The configuration Map to load as a Configuration object
      Returns:
      The parsed configuration
    • loadFromFile

      public Configuration loadFromFile(File source)
      Load the config from a file
      Parameters:
      source - The source to load the configuration from
      Returns:
      The parsed configuration
    • loadFromFile

      public Configuration loadFromFile(Path source)
      Load the config from a file Path
      Parameters:
      source - The source to load the configuration from
      Returns:
      The parsed configuration
    • loadFromFile

      public Configuration loadFromFile(URL source)
      Load the config from a URL file source
      Parameters:
      source - The source to load the configuration from
      Returns:
      The parsed configuration
    • loadFromFile

      public Configuration loadFromFile(String source)
      Load the config from a String file source
      Parameters:
      source - The source to load the configuration from
      Returns:
      The parsed configuration
    • deserializeConfig

      public IStruct deserializeConfig(File source)
      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

      public IStruct deserializeConfig(String source)
      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

      public IStruct deserializeConfig(URL source)
      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

      public IStruct deserializeConfig(Path source)
      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

      public IStruct mergeEnvironmentOverrides(IStruct config)
      Merge environment overrides with the configuration
      Parameters:
      config - The configuration to merge the environment overrides with
    • filterEnv

      public IStruct filterEnv(IStruct envCollection)
      Filter the environment variables for BoxLang specific ones
      Parameters:
      envCollection - The environment collection to filter
      Returns:
      The filtered environment
    • applyOverride

      public static void applyOverride(Map.Entry<Key,Object> entry, IStruct flatConfig)
      Apply an override to the flattened configuration
      Parameters:
      entry -
      flatConfig -