userver: userver/engine/subprocess/environment_variables.hpp File Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
environment_variables.hpp File Reference

Environment variables representation. More...

#include <string>
#include <unordered_map>
#include <userver/rcu/rcu.hpp>
+ Include dependency graph for environment_variables.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  engine::subprocess::EnvironmentVariablesUpdate
 Iterable environment variables wrapper to update values. More...
 
class  engine::subprocess::EnvironmentVariables
 Environment variables representation. More...
 

Namespaces

namespace  engine
 Asynchronous engine primitives.
 

Enumerations

enum class  engine::subprocess::Overwrite {
  kAllowed ,
  kForbidden ,
  kIgnored
}
 Overwrite modes. More...
 

Functions

EnvironmentVariables engine::subprocess::GetCurrentEnvironmentVariables ()
 Returns copy of the environment variables of the current process.
 
rcu::ReadablePtr< EnvironmentVariablesengine::subprocess::GetCurrentEnvironmentVariablesPtr ()
 
void engine::subprocess::UpdateCurrentEnvironmentVariables ()
 
void engine::subprocess::SetEnvironmentVariable (const std::string &variable_name, const std::string &value, Overwrite overwrite=Overwrite::kForbidden)
 Sets the environment variable with the specified overwrite type.
 
void engine::subprocess::UnsetEnvironmentVariable (const std::string &variable_name)
 Unsets the environment variable.
 

Detailed Description

Environment variables representation.

Definition in file environment_variables.hpp.

Enumeration Type Documentation

◆ Overwrite

enum class engine::subprocess::Overwrite
strong

Overwrite modes.

Enumerator
kAllowed 

Overwrites or creates the environment variable.

kForbidden 

Creates new environment variable, else throws std::runtime_error

kIgnored 

Does not overwrite the environment variable if the variable exists

Definition at line 102 of file environment_variables.hpp.

Function Documentation

◆ GetCurrentEnvironmentVariablesPtr()

rcu::ReadablePtr< EnvironmentVariables > engine::subprocess::GetCurrentEnvironmentVariablesPtr ( )

Returns thread-safe read only pointer to the environment variables of the current process.

◆ SetEnvironmentVariable()

void engine::subprocess::SetEnvironmentVariable ( const std::string &  variable_name,
const std::string &  value,
Overwrite  overwrite = Overwrite::kForbidden 
)

Sets the environment variable with the specified overwrite type.

Warning
Not thread-safe.

◆ UnsetEnvironmentVariable()

void engine::subprocess::UnsetEnvironmentVariable ( const std::string &  variable_name)

Unsets the environment variable.

Warning
Not thread-safe.

◆ UpdateCurrentEnvironmentVariables()

void engine::subprocess::UpdateCurrentEnvironmentVariables ( )

Fetches current environment variables for getting via GetCurrentEnvironmentVariables or GetCurrentEnvironmentVariablesPtr.