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
| Variable | Description | Example |
|---|---|---|
GAMEFLOW_REGION | Region the server is running in. | us-east |
GAMEFLOW_DEFAULT_PORT | Primary port the server listens on. | 7777 |
GAMEFLOW_{NAME}_PORT | One 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:
| Variable | Value |
|---|---|
GAMEFLOW_DEFAULT_PORT | 7777 |
GAMEFLOW_VOICE_CHAT_PORT | 9090 |
GAMEFLOW_DEBUG_PORT | 9091 |
Reading variables
Use your language's standard environment API. No SDK call needed.
- Unity (C#)
- Unreal (C++)
- Godot
- TypeScript
- Rust
- Go
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"));
FString Region = FPlatformMisc::GetEnvironmentVariable(TEXT("GAMEFLOW_REGION"));
int32 Port = FCString::Atoi(*FPlatformMisc::GetEnvironmentVariable(TEXT("GAMEFLOW_DEFAULT_PORT")));
int32 VoicePort = FCString::Atoi(*FPlatformMisc::GetEnvironmentVariable(TEXT("GAMEFLOW_VOICE_CHAT_PORT")));
var region := OS.get_environment("GAMEFLOW_REGION")
var port := OS.get_environment("GAMEFLOW_DEFAULT_PORT").to_int()
var voice_port := OS.get_environment("GAMEFLOW_VOICE_CHAT_PORT").to_int()
const region = process.env.GAMEFLOW_REGION;
const port = Number(process.env.GAMEFLOW_DEFAULT_PORT);
const voicePort = Number(process.env.GAMEFLOW_VOICE_CHAT_PORT);
let region = std::env::var("GAMEFLOW_REGION")?;
let port: u16 = std::env::var("GAMEFLOW_DEFAULT_PORT")?.parse()?;
let voice_port: u16 = std::env::var("GAMEFLOW_VOICE_CHAT_PORT")?.parse()?;
region := os.Getenv("GAMEFLOW_REGION")
port, _ := strconv.Atoi(os.Getenv("GAMEFLOW_DEFAULT_PORT"))
voicePort, _ := strconv.Atoi(os.Getenv("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_LEVELorMAX_PLAYERS. - Launch options: extra arguments appended to your server's start command.
Read your own variables the same way as the built-in ones.