COSY Docs

Environment Variables

Configure your game server and understand auto-generated variables.

Environment variables are key-value pairs passed into the Docker container at startup. They are the primary way to configure game server images.

User-Defined Variables

You can add, edit, and remove environment variables in the Settings view of any server. Common examples:

VariableExample ValuePurpose
EULATRUEAccept Minecraft EULA
TYPEFABRICMinecraft server type
VERSION1.20.4Game version
DIFFICULTYhardGame difficulty
MAX_PLAYERS20Player limit
SERVER_NAMEMy ServerDisplay name

The specific variables available depend on the Docker image you're using. Check the image's documentation on Docker Hub for a full list.

COSY Auto-Generated Variables

In addition to your custom variables, COSY automatically injects the following into every container:

VariableDescription
COSY_GAME_SERVER_UUIDThe server's unique database identifier
COSY_GAME_SERVER_NAMEThe display name you set in COSY
COSY_GAME_SERVER_OWNERUsername of the server owner
COSY_CONTAINER_SECRETA 32-character secret for authenticating custom metrics requests
COSY_BASE_URLThe base URL of the COSY backend API
COSY_METRICS_PERIOD_SECONDSHow often COSY polls container metrics

These are set automatically and cannot be overridden. The COSY_CONTAINER_SECRET is regenerated on every server start for security — game server plugins or scripts can use it to send custom metrics back to COSY.

Variable Precedence

If you define a variable with the same name as a COSY auto-generated variable, the auto-generated value takes priority. Avoid using the COSY_ prefix for your own variables.

On this page