blob: ed27ceeff89131a184e725dfff619692041b6b1a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#pragma once
#include <util/generic/strbuf.h>
#include <optional>
#include <string>
#include <vector>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
// NB: Currently not supported on other platforms.
#if defined(_linux_) || defined(_darwin_)
std::vector<std::string> GetEnvironNameValuePairs();
#endif
std::pair<TStringBuf, std::optional<TStringBuf>> ParseEnvironNameValuePair(TStringBuf pair);
std::optional<std::string> TryGetEnvValue(TStringBuf name);
std::string GetEnvValueOrThrow(TStringBuf name);
//! Returns the value of the environment variable #name parsed as #T (via |FromString|).
//! Throws if the variable is not set or its value cannot be parsed.
template <class T>
T GetEnvValueOrThrow(TStringBuf name);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
#define ENV_INL_H_
#include "env-inl.h"
#undef ENV_INL_H_
|