Uh oh!
There was an error while loading. Please reload this page.
forked from adeharo9/cpp-dotenv
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotenv.h
More file actions
Latest commit
56 lines (35 loc) · 1.25 KB
/
Copy pathdotenv.h
File metadata and controls
56 lines (35 loc) · 1.25 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include<string>
namespacedotenv
{
classdotenv
{
public:
using key_type = std::string;
using value_type = std::string;
public:
dotenv& load_dotenv(const std::string& dotenv_path = ".env",
constbool overwrite = false,
constbool interpolate = true);
const value_type operator[](const key_type& k) const;
public:
virtual~dotenv() = default;
dotenv(const dotenv&) = delete;
voidoperator=(const dotenv&) = delete;
static dotenv& instance();
bool loaded = false;
private:
dotenv() = default;
private:
// Declare static members (definitions are inline after the class)
// NOTE: env_filename is kept for backward compatibility; external code
// may reference dotenv::dotenv::env_filename directly.
staticconst std::string env_filename;
static dotenv _instance;
};
// C++17 inline variable definitions after class is complete
// Note: _instance cannot be inline inside the class due to incomplete type
inlineconst std::string dotenv::env_filename = ".env";
inline dotenv dotenv::_instance;
extern dotenv& env;
}