Function utils::getEnvULong
Defined in File MiscUtils.hpp
Function Documentation
-
inline auto utils::getEnvULong(const char *name) -> std::optional<unsigned long>
Read an environment variable as a non-negative integer.
Like getFilePath()’s own use of std::getenv, this is not thread-safe against a concurrent setenv(), so call it only during single-threaded setup.
- Parameters:
name – Name of the environment variable
- Throws:
std::runtime_error – if the variable is set to anything other than a plain base-10 non-negative integer that fits in an unsigned long
- Returns:
The variable’s value, if it is set and non-empty; std::nullopt if it is unset or empty