userver: userver/engine/subprocess/environment_variables.hpp File Reference
Loading...
Searching...
No Matches
environment_variables.hpp File Reference

Detailed Description

Environment variables representation.

Definition in file environment_variables.hpp.

Go to the source code of this file.

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

Classes

class  engine::subprocess::EnvironmentVariablesUpdate
 Iterable environment variables wrapper to update values. More...
 
class  engine::subprocess::EnvironmentVariables
 Environment variables representation. More...
 
class  engine::subprocess::EnvironmentVariablesScope
 RAII idiom guard of environment variables. 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.
 

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 108 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.