From 98a9b068a45612c0ecc58d424ae42fd2627959eb Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 29 Oct 2023 14:39:42 +0100 Subject: [PATCH] Updated the config.cpp --- src/api/config.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/api/config.cpp b/src/api/config.cpp index 309ae57..ecbff80 100644 --- a/src/api/config.cpp +++ b/src/api/config.cpp @@ -2,8 +2,6 @@ #include #include "config.h" -#define CONFIG_FILE "config.json" - bool config::is_valid_config(const json& config) { if (!config.contains("token")) { @@ -14,12 +12,12 @@ bool config::is_valid_config(const json& config) { return true; } -json config::read_config() { +json config::read_config(const std::string& path) { json config; - std::ifstream config_file(CONFIG_FILE); + std::ifstream config_file(path); if (!config_file.is_open()) { - std::cout << "Failed to open config file. Please create a " << CONFIG_FILE << " file in the same directory as the executable." << std::endl; + std::cout << "Failed to open config file. Please create a " << path << " file in the same directory as the executable." << std::endl; exit(1); }