diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-12 11:56:55 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-12 11:56:55 -0400 |
commit | 9c19aa4d3327eb5be8c4e25495ff56c46b77a0d2 (patch) | |
tree | b1b1987a2471299e1ce630fc0842195b3ef3210e /src | |
parent | remove direct call to addr in printing quad a for alpine support (diff) | |
download | wrapper-9c19aa4d3327eb5be8c4e25495ff56c46b77a0d2.tar.gz wrapper-9c19aa4d3327eb5be8c4e25495ff56c46b77a0d2.tar.bz2 wrapper-9c19aa4d3327eb5be8c4e25495ff56c46b77a0d2.zip |
makefile install and uninstall, use different config path
Diffstat (limited to 'src')
-rw-r--r-- | src/io/config.c | 3 | ||||
-rw-r--r-- | src/server/server.c | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/io/config.c b/src/io/config.c index bf9d96a..d6cb6c3 100644 --- a/src/io/config.c +++ b/src/io/config.c @@ -475,10 +475,11 @@ static void config_push_record(Record** buf, Record record, uint16_t* capacity, bool load_config(const char* path, RecordMap* map) { FILE* file = fopen(path, "r"); if (file == NULL) { - ERROR("Failed to open file %s: %s", path, strerror(errno)); return false; } + INFO("Using config file at path: %s", path); + line = 0; record_map_init(map); diff --git a/src/server/server.c b/src/server/server.c index bcb070d..c02a645 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -21,7 +21,16 @@ void server_init(uint16_t port, Server* server) { INFO("Server port set to %hu", port); create_binding(UDP, port, &server->udp); create_binding(TCP, port, &server->tcp); - load_config("config", &map); + + if (load_config("/etc/wrapper.conf", &map)) { + return; + } + + if (load_config("config", &map)) { + return; + } + + WARN("No dns config files were found"); } struct DnsRequest { |