Skip to main content

Environment Variables

Every game server starts with a set of environment variables that describe where it runs and which ports it listens on. GameFlow injects them automatically, and you can add your own when you create a game.

Looking for the launch payload?

Per-match data like the match id and team roster is not an environment variable. See Launch Payload.

Built-in variables​

VariableDescriptionExample
GAMEFLOW_REGIONRegion the server is running in.us-east
GAMEFLOW_DEFAULT_PORTPrimary port the server listens on.7777
GAMEFLOW_{NAME}_PORTOne per additional port. {NAME} is the port's label, uppercased, with spaces replaced by underscores.9090

All values are strings.

Additional ports​

If you configure additional ports on your game, each one gets its own variable. A game with a primary port and two additional ports labeled "voice chat" and "debug" receives:

VariableValue
GAMEFLOW_DEFAULT_PORT7777
GAMEFLOW_VOICE_CHAT_PORT9090
GAMEFLOW_DEBUG_PORT9091

Reading variables​

Use your language's standard environment API. No SDK call needed.

var region = Environment.GetEnvironmentVariable("GAMEFLOW_REGION");
var port = int.Parse(Environment.GetEnvironmentVariable("GAMEFLOW_DEFAULT_PORT"));
var voicePort = int.Parse(Environment.GetEnvironmentVariable("GAMEFLOW_VOICE_CHAT_PORT"));

Your own variables​

When you create a game, you can also set:

  • Environment variables: key/value pairs for configuration that stays the same across servers, like LOG_LEVEL or MAX_PLAYERS.
  • Launch options: extra arguments appended to your server's start command.

Read your own variables the same way as the built-in ones.