23 #include "envgateway.h" 24 #include "envgatewayparser.h" 28 EnvironmentGateway::EnvironmentGateway(std::shared_ptr<ContainerAbstractInterface> container) :
29 Gateway(ID, container)
33 EnvironmentGateway::~EnvironmentGateway()
40 EnvironmentGatewayParser::EnvironmentVariable variable;
42 if (!parser.parseEnvironmentGatewayConfigElement(element, variable, m_variables)) {
43 log_error() <<
"Could not parse environment gateway element";
47 m_variables[variable.first] = variable.second;
51 bool EnvironmentGateway::activateGateway()
53 if (m_variables.empty()) {
54 log_error() <<
"No environment variables set in gateway";
58 for (
auto &variable : m_variables) {
59 std::shared_ptr<ContainerAbstractInterface> container = getContainer();
60 if (!container->setEnvironmentVariable(variable.first, variable.second)) {
61 log_error() <<
"Could not set environment variable " << variable.first
62 <<
" for the container";
70 bool EnvironmentGateway::teardownGateway()
bool readConfigElement(const json_t *element)
Gateway specific parsing of config elements.
Developers guide to adding a config item: