Application configuration.
More...
#include <configuration.hpp>
|
| | Configuration (const Configuration &conf)=delete |
| | Configuration (Configuration &&conf)=delete |
| Configuration & | folders (const std::vector< std::filesystem::path > &folders) noexcept |
| Configuration & | name (const std::string &name) noexcept |
| Configuration & | profiles (const std::vector< std::string > &profiles) noexcept |
| Configuration & | load () |
| const anch::conf::Section * | section (const std::string &path) const noexcept |
| std::optional< std::string > | value (const std::string &path) const noexcept |
|
| static const Configuration & | inst () |
| static Configuration & | loader () noexcept |
Application configuration.
Load and manage configuration for an application.
It provides profiles inspired by Spring framework.
- Since
- 0.1
- Author
- Vincent Lachenal
◆ Configuration() [1/2]
| anch::conf::Configuration::Configuration |
( |
const Configuration & | conf | ) |
|
|
delete |
◆ Configuration() [2/2]
| anch::conf::Configuration::Configuration |
( |
Configuration && | conf | ) |
|
|
delete |
◆ folders()
| Configuration & anch::conf::Configuration::folders |
( |
const std::vector< std::filesystem::path > & | folders | ) |
|
|
noexcept |
Folders' setter
- Parameters
-
| folders | the folders to inspect |
- Returns
this
◆ inst()
| const Configuration & anch::conf::Configuration::inst |
( |
| ) |
|
|
static |
◆ load()
| Configuration & anch::conf::Configuration::load |
( |
| ) |
|
Parse Configuration from base name.
Configuration will load configuration files in this order:
- look for <name> file with registered extenions (default name to application ; ini, conf, cnf and properties extensions will always been registered) in folders
- raise error when file is not found
- load the first file found (others will be ignored)
- load included files (
anch::conf.includes , comma separated list in main file): an included file which is not found is an error
- active profiles are the profiles set with profiles , or
ANCH_PROFILES environment variable, or anch::conf.default-profiles (comma separated lists)
- for each active profile, in order, load <name>-<profile> then <include>-<profile> files when they exist: later files override previous values
- resolve placeholders (see Placeholders )
- Returns
- the Configuration
- Exceptions
-
◆ loader()
| Configuration & anch::conf::Configuration::loader |
( |
| ) |
|
|
staticnoexcept |
◆ name()
| Configuration & anch::conf::Configuration::name |
( |
const std::string & | name | ) |
|
|
noexcept |
◆ profiles()
| Configuration & anch::conf::Configuration::profiles |
( |
const std::vector< std::string > & | profiles | ) |
|
|
noexcept |
Configuration profiles setter
- Parameters
-
| profiles | the profiles to set |
- Returns
this
◆ section()
| const anch::conf::Section * anch::conf::Configuration::section |
( |
const std::string & | path | ) |
const |
|
noexcept |
Get section
- Parameters
-
| path | the section's path (dotted path, . for root section) |
- Returns
- the section when found,
NULL otherwise.
◆ value()
| std::optional< std::string > anch::conf::Configuration::value |
( |
const std::string & | path | ) |
const |
|
noexcept |
Get value
- Parameters
-
| path | the value's path (dotted path) |
- Returns
- the optional result
The documentation for this class was generated from the following file: