Agents 0.0.2
Edge AI Agents SDK
|
A utility class to load and access configuration values from .env files. More...
#include <config_loader.h>
Public Member Functions | |
ConfigLoader () | |
Construct a ConfigLoader with default .env file locations. | |
ConfigLoader (const std::string &customPath) | |
Construct a ConfigLoader with a custom .env file path. | |
std::string | get (const std::string &key, const std::string &defaultValue="") const |
Get a configuration value. | |
bool | has (const std::string &key) const |
Check if a key exists in the configuration. | |
Static Public Member Functions | |
static ConfigLoader & | getInstance () |
Get the singleton instance of ConfigLoader. | |
A utility class to load and access configuration values from .env files.
The ConfigLoader reads configuration from a .env file and provides access to these values. It automatically falls back to environment variables if a key is not found in the config file.
|
explicit |
Construct a ConfigLoader with a custom .env file path.
customPath | Path to the .env file |
std::string agents::ConfigLoader::get | ( | const std::string & | key, |
const std::string & | defaultValue = "" ) const |
Get a configuration value.
key | The key to look up |
defaultValue | Value to return if key is not found |
|
static |
Get the singleton instance of ConfigLoader.
bool agents::ConfigLoader::has | ( | const std::string & | key | ) | const |
Check if a key exists in the configuration.
key | The key to check |