OpenTTD Source: src/network/core/config.cpp File Reference

OpenTTD Source 13.1

Functions
config.cpp File Reference
`#include "../../stdafx.h"`
`#include <cstdlib>`
`#include "../../string_func.h"`
`#include "../../safeguards.h"`

Go to the source code of this file.

## Functions
static const char * | GetEnv (const char *variable, const char *fallback)
| Get the environment variable using std::getenv and when it is an empty string (or nullptr), return a fallback value instead. More...
const char * | NetworkCoordinatorConnectionString ()
| Get the connection string for the game coordinator from the environment variable OTTD_COORDINATOR_CS, or when it has not been set a hard coded default DNS hostname of the production server. More...
const char * | NetworkStunConnectionString ()
| Get the connection string for the STUN server from the environment variable OTTD_STUN_CS, or when it has not been set a hard coded default DNS hostname of the production server. More...
const char * | NetworkContentServerConnectionString ()
| Get the connection string for the content server from the environment variable OTTD_CONTENT_SERVER_CS, or when it has not been set a hard coded default DNS hostname of the production server. More...
const char * | NetworkContentMirrorConnectionString ()
| Get the connection string for the content mirror from the environment variable OTTD_CONTENT_MIRROR_CS, or when it has not been set a hard coded default DNS hostname of the production server. More...

## Detailed Description

Configuration of the connection strings for network stuff using environment variables.

Definition in file config.cpp.

## Function Documentation

## ◆ GetEnv()

static const char* GetEnv | ( | const char * | variable,
|  | const char * | fallback
| ) |  |
| static

Get the environment variable using std::getenv and when it is an empty string (or nullptr), return a fallback value instead.

Parameters

  variable | The environment variable to read from.
  fallback | The fallback in case the environment variable is not set.

Returns
  The environment value, or when that does not exist the given fallback value.

Definition at line 25 of file config.cpp.

References StrEmpty().

Referenced by NetworkContentMirrorConnectionString(), NetworkContentServerConnectionString(), NetworkCoordinatorConnectionString(), and NetworkStunConnectionString().

## ◆ NetworkContentMirrorConnectionString()

const char* NetworkContentMirrorConnectionString | ( |  | ) |

Get the connection string for the content mirror from the environment variable OTTD_CONTENT_MIRROR_CS, or when it has not been set a hard coded default DNS hostname of the production server.

Returns
  The content mirror's connection string.

Definition at line 66 of file config.cpp.

References GetEnv().

## ◆ NetworkContentServerConnectionString()

const char* NetworkContentServerConnectionString | ( |  | ) |

Get the connection string for the content server from the environment variable OTTD_CONTENT_SERVER_CS, or when it has not been set a hard coded default DNS hostname of the production server.

Returns
  The content server's connection string.

Definition at line 56 of file config.cpp.

References GetEnv().

Referenced by ClientNetworkContentSocketHandler::Connect().

## ◆ NetworkCoordinatorConnectionString()

const char* NetworkCoordinatorConnectionString | ( |  | ) |

Get the connection string for the game coordinator from the environment variable OTTD_COORDINATOR_CS, or when it has not been set a hard coded default DNS hostname of the production server.

Returns
  The game coordinator's connection string.

Definition at line 36 of file config.cpp.

References GetEnv().

## ◆ NetworkStunConnectionString()

const char* NetworkStunConnectionString | ( |  | ) |

Get the connection string for the STUN server from the environment variable OTTD_STUN_CS, or when it has not been set a hard coded default DNS hostname of the production server.

Returns
  The STUN server's connection string.

Definition at line 46 of file config.cpp.

References GetEnv().

Referenced by ClientNetworkStunSocketHandler::Connect().