-
Notifications
You must be signed in to change notification settings - Fork 31.1k
/
Copy pathnode_dotenv.h
42 lines (31 loc) · 983 Bytes
/
node_dotenv.h
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
35
36
37
38
39
40
41
42
#ifndef SRC_NODE_DOTENV_H_
#define SRC_NODE_DOTENV_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "util-inl.h"
#include "v8.h"
#include <map>
namespace node {
class Dotenv {
public:
enum ParseResult { Valid, FileError, InvalidContent };
struct env_file_data {
std::string path;
bool is_optional;
};
Dotenv() = default;
Dotenv(const Dotenv& d) = delete;
Dotenv(Dotenv&& d) noexcept = default;
Dotenv& operator=(Dotenv&& d) noexcept = default;
Dotenv& operator=(const Dotenv& d) = delete;
~Dotenv() = default;
void ParseContent(const std::string_view content);
ParseResult ParsePath(const std::string_view path);
std::string GetNodeOptions() const;
void SetEnvironment(Environment* env);
v8::Local<v8::Object> ToObject(Environment* env) const;
private:
std::map<std::string, std::string> store_;
};
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_NODE_DOTENV_H_