mirror of
https://github.com/GOSTSec/poolserver
synced 2025-03-12 21:41:08 +00:00
Added config file, fixed library linking, include directories, etc
This commit is contained in:
parent
400349c7e5
commit
f2b1506bab
@ -25,8 +25,10 @@ set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
set(Boost_ALL_DYN_LINK ON)
|
||||
|
||||
SET(Boost_ADDITIONAL_VERSIONS "1.54" "1.54.0")
|
||||
|
||||
# Boost
|
||||
find_package(Boost 1.53 COMPONENTS thread chrono program_options date_time REQUIRED)
|
||||
find_package(Boost 1.54 COMPONENTS thread chrono program_options date_time REQUIRED)
|
||||
message(status "** Boost Include: ${Boost_INCLUDE_DIR}")
|
||||
message(status "** Boost Libraries: ${Boost_LIBRARY_DIRS}")
|
||||
message(status "** Boost Libraries: ${Boost_LIBRARIES}")
|
||||
|
@ -29,15 +29,15 @@ add_executable(poolserver
|
||||
# Link libraries
|
||||
target_link_libraries(poolserver
|
||||
shared
|
||||
${MYSQL_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
/usr/local/lib/libboost_thread.so.1.53.0
|
||||
/usr/local/lib/libboost_program_options.so
|
||||
${MYSQL_LIBRARY}
|
||||
)
|
||||
|
||||
# Install
|
||||
if(UNIX)
|
||||
install(TARGETS poolserver DESTINATION bin)
|
||||
install(FILES poolserver.cfg.dist DESTINATION bin)
|
||||
elseif(WIN32)
|
||||
install(TARGETS poolserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(FILES poolserver.cfg.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
@ -1,21 +1,20 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "Server.h"
|
||||
#include "Config.h"
|
||||
#include "Log.h"
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
bool InitConfig(int argc, char *argv[])
|
||||
{
|
||||
// Containers
|
||||
boost::program_options::options_description descGeneric;
|
||||
boost::program_options::options_description descServer;
|
||||
boost::program_options::options_description descStratum;
|
||||
boost::program_options::options_description descLogging;
|
||||
boost::program_options::options_description descDatabase;
|
||||
boost::program_options::options_description descGeneric("Generic Options");
|
||||
boost::program_options::options_description descServer("Server Configuration");
|
||||
boost::program_options::options_description descStratum("Stratum Configuration");
|
||||
boost::program_options::options_description descLogging("Logging Configuration");
|
||||
boost::program_options::options_description descDatabase("Database Configuration");
|
||||
#ifdef WITH_MYSQL
|
||||
boost::program_options::options_description descMySQL;
|
||||
boost::program_options::options_description descMySQL("MySQL Configuration");
|
||||
#endif
|
||||
boost::program_options::options_description cmdlineOptions;
|
||||
boost::program_options::options_description fileOptions;
|
||||
@ -24,7 +23,7 @@ bool InitConfig(int argc, char *argv[])
|
||||
descGeneric.add_options()
|
||||
("version,v", "print version string")
|
||||
("help,h", "produce help message")
|
||||
("config,c", boost::program_options::value<std::string>()->default_value("settings.cfg"),"name of a file of a configuration.")
|
||||
("config,c", boost::program_options::value<std::string>()->default_value("poolserver.cfg"),"name of a file of a configuration.")
|
||||
;
|
||||
|
||||
// Server
|
||||
@ -78,7 +77,7 @@ bool InitConfig(int argc, char *argv[])
|
||||
std::ifstream ifs(sConfig.Get<std::string>("config").c_str());
|
||||
|
||||
if (!ifs.is_open()) {
|
||||
sLog.Error(LOG_GENERAL, "Failed opening config file: %s", sConfig.Get<std::string>("LogFilePath").c_str());
|
||||
sLog.Error(LOG_GENERAL, "Failed opening config file: %s", sConfig.Get<std::string>("config").c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
164
src/server/poolserver/poolserver.cfg.dist
Normal file
164
src/server/poolserver/poolserver.cfg.dist
Normal file
@ -0,0 +1,164 @@
|
||||
#############################
|
||||
# Server Configuration File
|
||||
#############################
|
||||
|
||||
###################################################################################################
|
||||
# SECTION INDEX
|
||||
#
|
||||
# SERVER CONFIGURATION
|
||||
# STRATUM CONFIGURATION
|
||||
# DATABASE CONFIGURATION
|
||||
# MYSQL CONFIGURATION
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
###################################################################################################
|
||||
# EXAMPLE CONFIG
|
||||
#
|
||||
# Variable
|
||||
# Description: Brief description what the variable is doing.
|
||||
# Important: Annotation for important things about this variable.
|
||||
# Example: "Example, i.e. if the value is a string"
|
||||
# Default: 10 - (Enabled|Comment|Variable name in case of grouped config options)
|
||||
# 0 - (Disabled|Comment|Variable name in case of grouped config options)
|
||||
#
|
||||
# Note to developers:
|
||||
# - Copy this example to keep the formatting.
|
||||
# - Line breaks should be at column 100.
|
||||
###################################################################################################
|
||||
|
||||
[Server Configuration]
|
||||
|
||||
###################################################################################################
|
||||
# SERVER CONFIGURATION
|
||||
#
|
||||
# MinDiffTime
|
||||
# Description: Minimum diff time (ms) in main server loop.
|
||||
# Important: Lowering this value increases cpu load but new packets are processed faster
|
||||
# Default: 100
|
||||
|
||||
MinDiffTime=100
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
[Stratum Configuration]
|
||||
|
||||
###################################################################################################
|
||||
# STRATUM CONFIGURATION
|
||||
#
|
||||
# StratumHost
|
||||
# Description: Bind stratum to IP/Hostname
|
||||
# Default: "0.0.0.0" - (Bind to all IPs on the system)
|
||||
|
||||
StratumHost="0.0.0.0"
|
||||
|
||||
#
|
||||
# StratumPort
|
||||
# Description: Stratum Port
|
||||
# Default: 3333
|
||||
|
||||
StratumPort=3333
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
[Logging Configuration]
|
||||
|
||||
###################################################################################################
|
||||
# LOGGING CONFIGURATION
|
||||
#
|
||||
# LogFilePath
|
||||
# Description: Location to save logfile to
|
||||
# Important: Do not add trailing slash
|
||||
# Example: "/var/log"
|
||||
# Default: "." - (Save log file next to executable)
|
||||
|
||||
LogFilePath="."
|
||||
|
||||
#
|
||||
# LogConsoleLevel
|
||||
# LogFileLevel
|
||||
# Description: Logging output level
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Error)
|
||||
# 2 - (Warning|LogFileLevel)
|
||||
# 3 - (Info|LogConsoleLevel)
|
||||
# 4 - (Debug|Set apropriate Log...DebugMask for debug output)
|
||||
|
||||
LogConsoleLevel=4
|
||||
LogFileLevel=4
|
||||
|
||||
#
|
||||
# LogConsoleDebugMask
|
||||
# LogFileDebugMask
|
||||
# Description: Debug output mask
|
||||
# Example: 5 - (1+4|Ouput LOG_GENERAL and LOG_DATABASE)
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (LOG_GENERAL)
|
||||
# 2 - (LOG_SERVER)
|
||||
# 4 - (LOG_DATABASE)
|
||||
|
||||
LogConsoleDebugMask=0
|
||||
LogFileDebugMask=0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
[Database Configuration]
|
||||
|
||||
###################################################################################################
|
||||
# DATABASE CONFIGURATION
|
||||
#
|
||||
# DatabaseDriver
|
||||
# Description: Database driver to use for data storage
|
||||
# Important: Server must be compiled with selected driver support
|
||||
# Example: "mysql"
|
||||
# Default: "." - (Save log file next to executable)
|
||||
|
||||
DatabaseDriver="mysql"
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
[MySQL Configuration]
|
||||
|
||||
###################################################################################################
|
||||
# MYSQL CONFIGURATION
|
||||
#
|
||||
# MySQLHost
|
||||
# Description: IP/Hostname of MySQL Server
|
||||
# Default: "127.0.0.1" - (Connect to localhost)
|
||||
|
||||
MySQLHost="127.0.0.1"
|
||||
|
||||
#
|
||||
# MySQLPort
|
||||
# Description: MySQL Server Port
|
||||
# Default: 3306 - (Default MySQL Server Port)
|
||||
|
||||
MySQLPort=3306
|
||||
|
||||
#
|
||||
# MySQLUser
|
||||
# Description: MySQL Server Username
|
||||
# Default: "" - (No Username)
|
||||
|
||||
MySQLUser=""
|
||||
|
||||
#
|
||||
# MySQLPass
|
||||
# Description: MySQL Server Password
|
||||
# Default: "" - (No Password)
|
||||
|
||||
MySQLPass=""
|
||||
|
||||
#
|
||||
# MySQLDatabase
|
||||
# Description: Name of MySQL Database
|
||||
# Default: "poolserver"
|
||||
|
||||
MySQLDatabase="poolserver"
|
||||
|
||||
#
|
||||
###################################################################################################
|
@ -20,6 +20,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Configuration
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Database
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Logging
|
||||
${Boost_INCLUDE_DIR}
|
||||
${MYSQL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
|
@ -25,7 +25,7 @@ enum LogLevel
|
||||
LOG_LEVEL_ERROR = 1,
|
||||
LOG_LEVEL_WARN = 2,
|
||||
LOG_LEVEL_INFO = 3,
|
||||
LOG_LEVEL_DEBUG = 4
|
||||
LOG_LEVEL_DEBUG = 4
|
||||
};
|
||||
|
||||
class Log
|
||||
|
Loading…
x
Reference in New Issue
Block a user