Browse Source

feat: setting config file from env

dev
Dnomd343 2 years ago
parent
commit
a719fe831e
  1. 2
      include/constant.h
  2. 6
      src/cleardns.c

2
include/constant.h

@ -12,7 +12,7 @@
#define DIVERTER_TIMEOUT 6
#define VERSION "1.3.0-beta1"
#define VERSION "1.3.0-beta2"
#define CONFIG_FILE "cleardns.yml"
#define ADGUARD_USER "admin"

6
src/cleardns.c

@ -17,6 +17,12 @@
char* init(int argc, char *argv[]) { // return config file
char *config = string_init(CONFIG_FILE);
if (getenv("CONFIG") != NULL) {
config = string_init(getenv("CONFIG"));
}
if (getenv("DEBUG") != NULL && !strcmp(getenv("DEBUG"), "TRUE")) {
LOG_LEVEL = LOG_DEBUG; // enable debug mode
}
for (int i = 0; i < argc; ++i) {
if (!strcmp(argv[i], "--debug")) {
LOG_LEVEL = LOG_DEBUG; // enable debug mode

Loading…
Cancel
Save