Skip to main content

Egg Variables

Each egg in Pterodactyl supports Variables that you can use in either the Install Script or the Config Parser. These variables provide a dynamic way to configure your server behavior and are highly useful for customization and modular egg design.

Variables are divided into two main types:

  • Default Variables: Automatically injected by the panel and wings.
  • Custom Variables: Defined manually in the "Variables" tab of the egg.

Variables

Default Variables

These are injected into every server environment by default and can be referenced using the following syntaxes:

  • In scripts: ${VARIABLE_NAME} or {{server.build.default.VARIABLE_NAME}}
  • In config parsers: {{server.build.default.VARIABLE_NAME}}
Variable NameDescriptionExample
TZTime Zone set in the panel's .env fileEtc/UTC
STARTUPThe actual resolved startup command for the server./run.sh -arg1
SERVER_MEMORYAllocated memory for the server in megabytes1024
SERVER_IPThe IP address assigned to the primary allocation192.168.1.10
SERVER_PORTThe main port assigned to the server27015
P_SERVER_LOCATIONThe name of the location (set by the admin in the panel)Amsterdam-01
P_SERVER_UUIDUUID of the server instance (used for tracking within Wings)ab12cd34-5678-90ef-ghij-klmn12345678
P_SERVER_ALLOCATION_LIMITThe maximum number of allocations available to this server (if set)3
USERThe user executing processes inside the containercontainer
HOMEThe home directory inside the container/home/container

These variables are especially useful when creating multi-purpose install scripts or handling conditional logic based on port, memory, or UUID.

Custom Variables

In addition to defaults, you can define your own Custom Variables in the egg configuration under the "Variables" tab. These are used to allow users or admins to provide input or modify parameters without directly changing the startup command.

They are referenced as:

  • In scripts: ${ENV_VAR} or {{env.ENV_VAR}}
  • In config parsers: {{env.ENV_VAR}}

Each custom variable allows you to define:

  • A default value
  • Description (shown to the user in the panel)
  • Rules (validation, required or not)
  • Whether it is viewable or editable by the user

Example use in a config parser:

{
"server.properties": {
"parser": "properties",
"find": {
"server-port": "{{server.build.default.port}}",
"max-players": "{{env.MAX_PLAYERS}}"
}
}
}

With custom variables, you can make your egg fully customizable while hiding sensitive or complex settings from end-users.

Best Practices

  • Use UPPERCASE for all variable names.
  • Clearly document custom variables with helpful descriptions.
  • Avoid redefining default variable names as custom ones.
  • Use fallback values where applicable in scripts.
  • Always validate inputs if used in file paths, URLs, or commands.