Rewrite electricity-logger to use an sqlite3 database
This commit is contained in:
33
include/electricity/server/configuration.hpp
Normal file
33
include/electricity/server/configuration.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user