Skip to content

Environment

The BlueDragonMC/Server project loads several environment configuration options at startup that influence its interaction with other services.

Development and Production Modes

The server is determined to be in “Dev” or “Prod” modes by looking at the BLUEDRAGON_ENV_TYPE environment variable. If it’s set to “DEV”, the server is assumed to be in development mode, and if not, the server will be set to production mode.

If the BLUEDRAGON_ENV_TYPE is not set, the fallback is to check for a directory called /server at the file system root. If it exists, then production mode is used; if not, development mode.

Environment Variable Reference

Environment variableDefaultsDescription
BLUEDRAGON_QUEUE_TYPEDev: TEST
Prod: IPC
Use “IPC” to connect to Puffin for queueing, or “TEST” for a fully-local/single-instance queue
BLUEDRAGON_MONGO_CONNECTION_STRINGDev: mongodb://localhost:27017
Prod: mongodb://mongo:27017
The hostname that resolves to a MongoDB instance
BLUEDRAGON_PUFFIN_HOSTNAMEDev: localhost
Prod: puffin
The hostname that resolves to a Puffin instance
BLUEDRAGON_PUFFIN_PORT50051The port of Puffin’s gRPC server.
BLUEDRAGON_LUCKPERMS_HOSTNAMEDev: http://localhost:8080
Prod: http://luckperms:8080
The hostname that resolves to a standalone LuckPerms instance
BLUEDRAGON_DEFAULT_GAMElobbyThe game to automatically create on startup. Typically used to immediately initialize a lobby on each game server.
BLUEDRAGON_AGONES_DISABLEDNot setIf this environment variable is present with any value, Agones integration will be disabled.
PUFFIN_VELOCITY_SECRETNot setThe Velocity modern forwarding secret. If not present, Velocity forwarding is disabled.
BLUEDRAGON_GRPC_SERVER_PORT50051The port to listen on for gRPC requests.

View ConfiguredEnvironment source code for more details about server environment configuration.

Other Environment Information

  • The Environment class also stores version information handled by the Blossom Gradle plugin. See GitVersionInfo for more details.
  • The environment contains a list of all registered games obtained from the GameLoader.

Server Naming

Every game server must have a unique name to interact properly with other services. The default ConfiguredEnvironment goes through the following process for determining a server’s name:

  1. If the HOSTNAME environment variable is set, its value will be used as the server name.
  2. If the server is in development mode or Agones integration is disabled, a random string will be created and used.
  3. If the server is in production mode and Agones integration is enabled, a gRPC request will be sent to get the server name from the Agones gRPC API.

The result is then cached for future lookups.