Environment Variables
Environment variables are passed into your process at runtime. Hathora passes in default environment variables and allows you to set your own.
Default variables
Along with the environment variables that you configure during deployment, the following are available by default:
Variable name | Example value |
---|---|
HATHORA_APP_ID | app-e0d94c55-70f0-4489-aa5b-00b7669b31e3 |
HATHORA_APP_SECRET | secret-51da7ef7-69eb-4737-bb3e-12c4db6b39e2 |
HATHORA_PROCESS_ID | fa861d23-7ef7-4a14-bb99-599b0f129de8 |
HATHORA_DEPLOYMENT_ID | 1 |
HATHORA_REGION | Singapore |
HATHORA_ROOMS_PER_PROCESS | 1 |
HATHORA_INITIAL_ROOM_ID | 2wez09em9il9d |
HATHORA_INITIAL_ROOM_CONFIG | { "mode": "1v1" } |
HATHORA_HOSTNAME | abcdef.edge.hathora.dev |
HATHORA_DEFAULT_PORT | 54562 |
HATHORA_${ADDITIONAL_PORT_NAME}_PORT | 44567 |
HATHORA_${ADDITIONAL_PORT_NAME_2}_PORT | 39484 |
Configure variables
Set environment variables through the Hathora Console. You can either configure the variables when creating a new application or through the settings page.
Access variables
Retrieve the value of an environment variable from an active server process.
- Unity
- Unreal
- Godot
- JS / TS
Environment.GetEnvironmentVariable("ENV_VAR_NAME")
FPlatformMisc::GetEnvironmentVariable(TEXT("ENV_VAR_NAME"))
OS.get_environment("ENV_VAR_NAME")
process.env.ENV_VAR_NAME