server: added NO_LOCALHOST_ONLY_SETTING cmake option for buildroot
if enabled traintatic-server will always listen on all interfaces.
Dieser Commit ist enthalten in:
Ursprung
3c4122c13d
Commit
ef57b4bc4b
@ -187,6 +187,13 @@ file(GLOB TEST_SOURCES
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLE_LOG_DEBUG")
|
||||
|
||||
### OPTIONS ###
|
||||
|
||||
if(NO_LOCALHOST_ONLY_SETTING)
|
||||
message(STATUS "Setting localhost only removed")
|
||||
add_definitions(-DNO_LOCALHOST_ONLY_SETTING)
|
||||
endif()
|
||||
|
||||
### PLATFORM ###
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
||||
@ -48,7 +48,9 @@ Settings::PreStart Settings::getPreStartSettings(const std::filesystem::path& pa
|
||||
|
||||
Settings::Settings(const std::filesystem::path& path)
|
||||
: m_filename{path / filename}
|
||||
#ifndef NO_LOCALHOST_ONLY_SETTING
|
||||
, localhostOnly{this, "localhost_only", true, PropertyFlags::ReadWrite, [this](const bool& /*value*/){ saveToFile(); }}
|
||||
#endif
|
||||
, port{this, "port", Server::defaultPort, PropertyFlags::ReadWrite, [this](const uint16_t& /*value*/){ saveToFile(); }}
|
||||
, discoverable{this, "discoverable", true, PropertyFlags::ReadWrite, [this](const bool& /*value*/){ saveToFile(); }}
|
||||
, lastWorld{this, "last_world", "", PropertyFlags::ReadWrite | PropertyFlags::Internal, [this](const std::string& /*value*/){ saveToFile(); }}
|
||||
@ -64,8 +66,10 @@ Settings::Settings(const std::filesystem::path& path)
|
||||
m_interfaceItems.add(loadLastWorldOnStartup);
|
||||
m_interfaceItems.add(autoSaveWorldOnExit);
|
||||
|
||||
#ifndef NO_LOCALHOST_ONLY_SETTING
|
||||
Attributes::addCategory(localhostOnly, Category::network);
|
||||
m_interfaceItems.add(localhostOnly);
|
||||
#endif
|
||||
Attributes::addCategory(port, Category::network);
|
||||
m_interfaceItems.add(port);
|
||||
Attributes::addCategory(discoverable, Category::network);
|
||||
|
||||
@ -63,7 +63,9 @@ class Settings : public Object
|
||||
|
||||
static PreStart getPreStartSettings(const std::filesystem::path& path);
|
||||
|
||||
#ifndef NO_LOCALHOST_ONLY_SETTING
|
||||
Property<bool> localhostOnly;
|
||||
#endif
|
||||
Property<uint16_t> port;
|
||||
Property<bool> discoverable;
|
||||
Property<std::string> lastWorld;
|
||||
|
||||
@ -218,7 +218,13 @@ Traintastic::RunStatus Traintastic::run(const std::string& worldUUID, bool simul
|
||||
|
||||
try
|
||||
{
|
||||
m_server = std::make_shared<Server>(settings->localhostOnly, settings->port, settings->discoverable);
|
||||
m_server = std::make_shared<Server>(
|
||||
#ifndef NO_LOCALHOST_ONLY_SETTING
|
||||
settings->localhostOnly,
|
||||
#else
|
||||
true,
|
||||
#endif
|
||||
settings->port, settings->discoverable);
|
||||
}
|
||||
catch(const LogMessageException& e)
|
||||
{
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren