33 lines
966 B
C++
33 lines
966 B
C++
#pragma once
|
|
#include <chrono>
|
|
#include <mutex>
|
|
#include <string>
|
|
|
|
namespace Server
|
|
{
|
|
class Configuration {
|
|
private:
|
|
std::string logDirectory;
|
|
std::string serverDomain;
|
|
std::string lastExternalIp;
|
|
std::chrono::time_point<std::chrono::steady_clock> lastIpCheckTimePoint;
|
|
std::mutex externalIpRefreshMutex;
|
|
|
|
Configuration();
|
|
Configuration(Configuration & other) = delete;
|
|
Configuration(Configuration && other) = delete;
|
|
Configuration & operator=(Configuration & other) = delete;
|
|
Configuration & operator=(Configuration && other) = delete;
|
|
|
|
void RefreshExternalIp();
|
|
bool ExternalIpRequiresRefresh() const;
|
|
|
|
public:
|
|
void Setup(std::string & electricityLogDirectory, std::string const & serverDomain);
|
|
|
|
std::string const & GetLogDirectory() const;
|
|
std::string const & GetExternalServerIp();
|
|
|
|
static Configuration & Get();
|
|
};
|
|
} |