Skip to main content

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 nameExample value
HATHORA_APP_IDapp-e0d94c55-70f0-4489-aa5b-00b7669b31e3
HATHORA_APP_SECRETsecret-51da7ef7-69eb-4737-bb3e-12c4db6b39e2
HATHORA_PROCESS_IDfa861d23-7ef7-4a14-bb99-599b0f129de8
HATHORA_DEPLOYMENT_ID1
HATHORA_REGIONSingapore
HATHORA_ROOMS_PER_PROCESS1
HATHORA_INITIAL_ROOM_ID2wez09em9il9d
HATHORA_INITIAL_ROOM_CONFIG{ "mode": "1v1" }
HATHORA_HOSTNAMEabcdef.edge.hathora.dev
HATHORA_DEFAULT_PORT54562
HATHORA_${ADDITIONAL_PORT_NAME}_PORT44567
HATHORA_${ADDITIONAL_PORT_NAME_2}_PORT39484

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.

Environment.GetEnvironmentVariable("ENV_VAR_NAME")