Updated the config.cpp

This commit is contained in:
Mathias Wagner 2023-10-29 14:39:42 +01:00
parent 04904c04bc
commit 98a9b068a4
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -2,8 +2,6 @@
#include <iostream>
#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);
}