class CrConfig::Providers::FolderProfileConfigProvider

Overview

Will load different configuration files in a tree of folders based on configuration profile settings

Provider that will visit all folders directly under a root folder, and attempt to load config files in those folders using a ProfileFileConfigProvider to select which config files to load.

Assume a folder structure like: root_config ├── database │ ├── config.local.yml │ ├── config.test.yml │ └── config.yml ├── misc │ ├── config.test.yml │ └── config.yml └── server ├── config.local.yml └── config.yml

Then

FolderProfileConfigProvider.new
  .folder("root_config")
  .base_file("config.yml")
  .profiles { ["test"] }

Will read configuration files in this order: root_config/database/config.yml root_config/database/config.test.yml root_config/misc/config.yml root_config/misc/config.test.yml root_config/server/config.yml

Defined in:

cr-config/abstract_provider.cr

Instance Method Summary

Instance methods inherited from class CrConfig::Providers::AbstractProvider

populate(builder : AbstractBuilder) populate

Instance Method Detail

def base_file(base_file : String) #

Base name for the configuration files


[View source]
def folder(folder_path : String) #

[View source]
def populate(builder : AbstractBuilder) #
Description copied from class CrConfig::Providers::AbstractProvider

This method gets called with the instance of the configuration builder during config building.

Use this method to populate the builder with any configuration name / values that this provider... provides


[View source]
def profiles(&block : -> Array(String)) #

Block to be run when determining which "profiles" to load


[View source]
def separator(profile_separator : String) #

Seperator to use when constructing the different profile versions of the config file. See #populate for details on file construction


[View source]