OpenTTD Source 20260109-master-g241b5fcdfe
config.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD 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.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "../../stdafx.h"
11
12#include "../../string_func.h"
13
14#include "../../safeguards.h"
15
22{
23 return GetEnv("OTTD_COORDINATOR_CS").value_or("coordinator.openttd.org");
24}
25
32{
33 return GetEnv("OTTD_STUN_CS").value_or("stun.openttd.org");
34}
35
42{
43 return GetEnv("OTTD_CONTENT_SERVER_CS").value_or("content.openttd.org");
44}
45
52{
53 return GetEnv("OTTD_CONTENT_MIRROR_URI").value_or("https://binaries.openttd.org/bananas");
54}
55
61std::string_view NetworkSurveyUriString()
62{
63 return GetEnv("OTTD_SURVEY_URI").value_or("https://survey-participate.openttd.org/");
64}
std::string_view NetworkStunConnectionString()
Get the connection string for the STUN server from the environment variable OTTD_STUN_CS,...
Definition config.cpp:31
std::string_view NetworkCoordinatorConnectionString()
Get the connection string for the game coordinator from the environment variable OTTD_COORDINATOR_CS,...
Definition config.cpp:21
std::string_view NetworkContentMirrorUriString()
Get the URI string for the content mirror from the environment variable OTTD_CONTENT_MIRROR_URI,...
Definition config.cpp:51
std::string_view NetworkSurveyUriString()
Get the URI string for the survey from the environment variable OTTD_SURVEY_URI, or when it has not b...
Definition config.cpp:61
std::string_view NetworkContentServerConnectionString()
Get the connection string for the content server from the environment variable OTTD_CONTENT_SERVER_CS...
Definition config.cpp:41
std::optional< std::string_view > GetEnv(const char *variable)
Get the environment variable using std::getenv and when it is an empty string (or nullptr),...
Definition string.cpp:854