」 feat: changed to use the define

This commit is contained in:
2025-05-06 16:14:22 +02:00
parent 922269ed50
commit a70a563f2d

View File

@ -6,13 +6,14 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/10 13:08:36 by adjoly #+# #+# */
/* Updated: 2025/04/28 14:29:20 by adjoly ### ########.fr */
/* Updated: 2025/05/06 16:14:03 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <log.hpp>
#include <fstream>
#include <help.hpp>
#include <sstream>
#include <sys/stat.h>
#include <unistd.h>
#include <webserv.hpp>
@ -28,11 +29,13 @@ void _printHelp(void) {
void _generateConf(void) {
webserv::Logger _log;
if (access("./sample.conf", F_OK) == 0) {
if (access(SAMPLE_CONF_PATH, F_OK) == 0) {
_log.warn(std::string(SAMPLE_CONF_PATH) + " already exist, aborting");
} else {
_log.info("generating config into ./sample.conf...");
std::ofstream file("./sample.conf");
std::stringstream str;
str << "generating config into " << SAMPLE_CONF_PATH << "...";
_log.info(str.str());
std::ofstream file(SAMPLE_CONF_PATH);
if (file.is_open()) {
file << "[server]\nhost = \"localhost\"\nport = "
"8080\n\n[server.location./]\nmethods = { \"GET\" }\nroot "