Egg Variables
Let users and administrators change a server's settings without editing its startup command.
Introduction
Variables are per-server settings, such as the game version or the maximum number of players. Each becomes an environment variable in the server's container, usable in the startup command, install script, and configuration files.
Manage them on the egg's Variables tab. The Panel also sets some variables for every server; see Built-In Variables.
Creating a Variable
Click Create Variable and fill in:
- Name: A friendly name users see, such as
Max Players. - Description: Tells users what the variable does.
- Environment Variable: The name inside the container, such as
MAX_PLAYERS. Letters, numbers, and underscores only. Wings passes the name in uppercase, so use uppercase names to avoid confusion. - Default Value: The value new servers start with.
- Users Can View: Whether users see the variable on their server's Startup page.
- Users Can Edit: Whether users may change the value.
- Input Rules: Laravel validation rules that every value must pass.
Click Create Variable to save it.
Hiding a variable from users does not make it secret. Its value is still in the server's environment, where the server's processes can read it. Do not use variables for secrets users must not see.
Using a Variable
Refer to a variable by its environment variable name. The syntax depends on where you use it:
| Where | How | Example |
|---|---|---|
| Startup command | {{NAME}} | --max-players {{MAX_PLAYERS}} |
| Install script | $NAME or ${NAME} | echo "players=${MAX_PLAYERS}" |
| Configuration files | {{env.NAME}} | "max-players": "{{env.MAX_PLAYERS}}" |
Users see the startup command with values filled in for {{SERVER_MEMORY}}, {{SERVER_IP}}, {{SERVER_PORT}}, and the egg's own variables, and [hidden] for variables they cannot view. Placeholders are case-sensitive; any other placeholder stays as written.
Input Rules
Separate rules with |. The most common:
| Rule | Meaning |
|---|---|
required | A value must be given. |
nullable | The value may be empty. |
string | The value is text. |
numeric | The value is a number. |
integer | The value is a whole number. |
boolean | The value is 1 or 0. Values arrive as text, so true fails. |
between:1,64 | A number from 1 to 64, or text of 1 to 64 characters. |
max:20 | A number up to 20, or text of up to 20 characters. |
in:survival,creative | One of the listed values. |
regex:/^[\w.-]+\.jar$/ | Matches a regular expression. |
For example, required|string|max:20 requires text of at most 20 characters. New variables start with these rules.
Details that decide whether a value passes:
between,max, andmincompare the number only when the rules also includeintegerornumeric. Otherwise they count characters, sorequired|max:128accepts500.- Values are trimmed at both ends, and an empty value reaches the rules as null. Without
nullable, rules such asstringfail on it. - Rules are split at every
|, so a|inside a regular expression cuts it in two. Leave|out of patterns.
The rules also set how the variable appears on the Startup page:
boolean,in:0,1, orin:true,falseshows a switch. If its rules also includestring, the switch savestrueorfalse; otherwise it saves1or0. Thebooleanrule rejectstrueandfalse, so pairstringwithin:true,falseinstead.- Any other
in:rule shows a list of the allowed values. - Everything else shows a text field.
Startup command playground
Startup command
Memory (MiB)
Allocation IP
Allocation port
On the Startup page
What users see as the startup commandjava -Xms128M -Xmx4096M -jar paper.jar
Variables
Name
Environment variable
Default value
Value a user saves
Input rules
Name
Environment variable
Default value
Value a user saves
Input rules
Name
Environment variable
Default value
Value a user saves
Input rules
In the container: 11 environment variables
Wings does not fill in the placeholders. It passes the command as written in STARTUP, next to these variables, and leaves running it to the image's entrypoint. Hidden variables are here too.
| Name | Value | Set by |
|---|---|---|
| TZ | UTC | Wings |
| STARTUP | java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}} The command as written, placeholders included. | Wings |
| SERVER_MEMORY | 4096 | Wings |
| SERVER_IP | 192.168.1.10 | Wings |
| SERVER_PORT | 25565 | Wings |
| SERVER_JARFILE | paper.jar | Egg variable |
| MINECRAFT_VERSION | latest | Egg variable |
| BUILD_NUMBER | latest | Egg variable |
| P_SERVER_LOCATION | us1 | Panel |
| P_SERVER_UUID | 6d1f7929-5c2e-4cd4-99af-924dacb15537 | Panel |
| P_SERVER_ALLOCATION_LIMIT | 1.000000 | Panel |
Reserved Names
These environment variable names are reserved in any letter case:
SERVER_MEMORY, SERVER_IP, SERVER_PORT, ENV, HOME, USER, STARTUP, SERVER_UUID, and UUID.
Built-In Variables
Every server's container gets these variables, whatever its egg:
| Variable | Value | Example |
|---|---|---|
STARTUP | The startup command, with variables not yet filled in. | java -jar {{SERVER_JARFILE}} |
SERVER_MEMORY | The server's memory limit, in MiB. | 1024 |
SERVER_IP | The primary allocation's IP address. Wings replaces 127.0.0.1 with the Docker network interface. | 192.168.1.10 |
SERVER_PORT | The primary allocation's port. | 25565 |
TZ | The node's time zone. Wings detects it, or you can set system.timezone in Wings' configuration. | Europe/London |
P_SERVER_UUID | The server's UUID. | 6d1f7929-5c2e-4cd4-99af-924dacb15537 |
P_SERVER_LOCATION | The node location's short code. | us1 |
P_SERVER_ALLOCATION_LIMIT | How many allocations the server may have. Written with decimals, and empty when there is no limit. | 1.000000 |
Wings sets TZ, STARTUP, SERVER_MEMORY, SERVER_IP, and SERVER_PORT first and skips an egg variable with any of those names.
The official Docker images also set USER=container and HOME=/home/container.
Changing a Server's Variables
Users change the variables they may edit on their server's Startup page. Administrators can change all of a server's variables on its Startup tab in the admin area. New values apply on the next start.
Last updated on