-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Coal
committed
Feb 22, 2022
1 parent
c92deed
commit d65c62c
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include <cstdlib> | ||
#include <string> | ||
|
||
class Env { | ||
public: | ||
static std::string get(std::string key, std::string default_value ) { | ||
const char* value = std::getenv(key.c_str()); | ||
if (value == NULL) { | ||
return default_value; | ||
} | ||
|
||
return value; | ||
} | ||
|
||
static int get(std::string key, int default_value) { | ||
const char* value = std::getenv(key.c_str()); | ||
|
||
if (value == NULL) { | ||
return default_value; | ||
} | ||
|
||
return std::atoi(value); | ||
} | ||
}; |