Config loader
FossilOrigin-Name: 2f6afc1e361e82d5266a4a7b8293ebfec841e69a822d2db34c393a45d6f51162
This commit is contained in:
parent
e40867d81c
commit
733bd46bf1
3 changed files with 62 additions and 0 deletions
|
@ -4,6 +4,7 @@ project(wormhole)
|
|||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)
|
||||
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
# C++ settings
|
||||
|
@ -13,6 +14,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
|||
|
||||
include_directories(wormhole
|
||||
${LIBMICROHTTPD_INCLUDE_DIRS}
|
||||
${YAML_CPP_INCLUDE_DIRS}
|
||||
src/
|
||||
)
|
||||
|
||||
|
@ -22,10 +24,12 @@ set(sources src/main.cpp
|
|||
src/database/sqlite/sqlite.cpp
|
||||
src/http/httpserver.cpp
|
||||
src/http/microhttpd_server.cpp
|
||||
src/config/config_loader.cpp
|
||||
src/logger.cpp)
|
||||
|
||||
# files
|
||||
add_executable(wormhole ${sources})
|
||||
target_link_libraries(wormhole ${CMAKE_DL_LIBS}
|
||||
${LIBMICROHTTPD_LIBRARIES}
|
||||
${YAML_CPP_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
|
24
src/config/config_loader.cpp
Normal file
24
src/config/config_loader.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Wormhole - Federated social network
|
||||
* Copyright (C) 2022 Nekobit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config_loader.h"
|
||||
|
||||
using namespace Config;
|
||||
|
||||
ConfigLoader::ConfigLoader()
|
||||
{}
|
34
src/config/config_loader.h
Normal file
34
src/config/config_loader.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Wormhole - Federated social network
|
||||
* Copyright (C) 2022 Nekobit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
class ConfigLoader
|
||||
{
|
||||
public:
|
||||
ConfigLoader();
|
||||
~ConfigLoader() = default;
|
||||
private:
|
||||
/** @brief Config parser for YAML */
|
||||
YAML::Node cfg;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue