{
    "_comment": "DO NOT EDIT: generated by plugin/egg/build-egg.mjs in CerebRUST/plugin. Built from pterodactyl/panel@v1.15.1 database/Seeders/eggs/rust/egg-rust.json (sha256 24f8e602179561301dd29465b8c4c06a4f1f4cad86f9dbcbe3ac1f34e45702d0). Egg version 2.0.0; installs CerebRUST plugin 0.15.0. Edits made in the panel are lost on the next import — change the generator instead.",
    "meta": {
        "version": "PTDL_v2",
        "update_url": "https://app.cerebrust.xyz/download/egg/egg-rust-cerebrust.json"
    },
    "name": "Rust (CerebRUST)",
    "author": "support@cerebrust.xyz",
    "description": "The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.\n\nCerebRUST edition: the command line carries only the ports the panel assigns, RCON, and the server identity. Everything else — name, description, world size, seed, player limit — lives in server.cfg and is set from the CerebRUST dashboard, because a setting passed as a startup argument overrides server.cfg at boot and cannot be handed over. A new server boots once on Facepunch's defaults, is configured, and is restarted.",
    "features": [
        "steam_disk_space"
    ],
    "docker_images": {
        "ghcr.io/pterodactyl/games:rust": "ghcr.io/pterodactyl/games:rust"
    },
    "file_denylist": [],
    "startup": "$( [ \"${CEREBRUST_PLUGIN_UPDATE}\" != \"1\" ] || { mkdir -p oxide/plugins && curl -sSL -o oxide/plugins/.Cerebrust.download \"${CEREBRUST_ASSETS}/download/plugin/Cerebrust.cs\" && grep -q 'namespace Oxide.Plugins' oxide/plugins/.Cerebrust.download && mv -f oxide/plugins/.Cerebrust.download oxide/plugins/Cerebrust.cs; rm -f oxide/plugins/.Cerebrust.download; } >/dev/null 2>&1 ) ./RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.queryport {{QUERY_PORT}} +server.identity \"rust\" +rcon.port {{RCON_PORT}} +rcon.web true +rcon.password \\\"{{RCON_PASS}}\\\" +app.port {{APP_PORT}}",
    "config": {
        "files": "{\n    \"oxide/config/Cerebrust.json\": {\n        \"parser\": \"json\",\n        \"find\": {\n            \"IngestToken\": \"{{env.CEREBRUST_TOKEN}}\",\n            \"ApiBaseUrl\": \"{{env.CEREBRUST_API}}\"\n        }\n    }\n}",
        "startup": "{\r\n    \"done\": \"Server startup complete\"\r\n}",
        "logs": "{}",
        "stop": "quit"
    },
    "scripts": {
        "installation": {
            "script": "#!/bin/bash\r\n# steamcmd Base Installation Script\r\n#\r\n# Server Files: /mnt/server\r\n\r\nSRCDS_APPID=258550\r\n\r\n## just in case someone removed the defaults.\r\nif [ \"${STEAM_USER}\" == \"\" ]; then\r\n    echo -e \"steam user is not set.\\n\"\r\n    echo -e \"Using anonymous user.\\n\"\r\n    STEAM_USER=anonymous\r\n    STEAM_PASS=\"\"\r\n    STEAM_AUTH=\"\"\r\nelse\r\n    echo -e \"user set to ${STEAM_USER}\"\r\nfi\r\n\r\n## download and install steamcmd\r\ncd /tmp\r\nmkdir -p /mnt/server/steamcmd\r\ncurl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz\r\ntar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd\r\nmkdir -p /mnt/server/steamapps # Fix steamcmd disk write error when this folder is missing\r\ncd /mnt/server/steamcmd\r\n\r\n# SteamCMD fails otherwise for some reason, even running as root.\r\n# This is changed at the end of the install process anyways.\r\nchown -R root:root /mnt\r\nexport HOME=/mnt/server\r\n\r\n## install game using steamcmd\r\n./steamcmd.sh +force_install_dir /mnt/server +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} +app_update ${SRCDS_APPID} ${EXTRA_FLAGS} validate +quit ## other flags may be needed depending on install. looking at you cs 1.6\r\n\r\n## set up 32 bit libraries\r\nmkdir -p /mnt/server/.steam/sdk32\r\ncp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so\r\n\r\n## set up 64 bit libraries\r\nmkdir -p /mnt/server/.steam/sdk64\r\ncp -v linux64/steamclient.so ../.steam/sdk64/steamclient.so\r\n# ---------------------------------------------------------------------------\r\n# CerebRUST additions — appended to the upstream install script by build-egg.mjs.\r\n#\r\n# DO NOT EDIT THIS IN THE PANEL. The egg is generated; a hand edit in the panel's script box is\r\n# lost the next time somebody imports a new version. Edit plugin/egg/install-tail.sh instead.\r\n# ---------------------------------------------------------------------------\r\n#\r\n# Oxide itself is installed by the container entrypoint on *every* boot, not here, so all this has\r\n# to do is put Cerebrust.cs where Oxide will find it and make sure a config file exists before the\r\n# first boot. That second half is load-bearing: wings writes IngestToken into\r\n# oxide/config/Cerebrust.json at every start via the egg's `config.files`, and a file it has to\r\n# create from nothing is a file the plugin then reads as empty.\r\n\r\necho \"Installing the CerebRUST plugin...\"\r\n\r\nCEREBRUST_ASSETS=\"${CEREBRUST_ASSETS:-https://app.cerebrust.xyz}\"\r\n\r\nmkdir -p /mnt/server/oxide/plugins /mnt/server/oxide/config\r\n\r\nif curl -sSL -o /tmp/Cerebrust.cs \"${CEREBRUST_ASSETS}/download/plugin/Cerebrust.cs\" \\\r\n    && grep -q 'namespace Oxide.Plugins' /tmp/Cerebrust.cs; then\r\n    mv -f /tmp/Cerebrust.cs /mnt/server/oxide/plugins/Cerebrust.cs\r\n    echo \"Installed oxide/plugins/Cerebrust.cs\"\r\nelse\r\n    # Never fail the install over this. A CerebRUST outage must not stop somebody standing up a\r\n    # Rust server — they can drop the plugin in by hand, and the server boot will fetch it anyway\r\n    # when CEREBRUST_PLUGIN_UPDATE is on.\r\n    echo \"WARNING: could not download Cerebrust.cs from ${CEREBRUST_ASSETS}.\"\r\n    echo \"         Install it by hand, or reinstall once CerebRUST is reachable.\"\r\nfi\r\nrm -f /tmp/Cerebrust.cs\r\n\r\n# Only ever *create* this file. A reinstall must not blank a token somebody set by hand before\r\n# they moved onto this egg.\r\nif [ ! -f /mnt/server/oxide/config/Cerebrust.json ]; then\r\n    cat > /mnt/server/oxide/config/Cerebrust.json <<'JSON'\r\n{\r\n  \"ApiBaseUrl\": \"https://api.cerebrust.xyz\",\r\n  \"IngestToken\": \"\",\r\n  \"verbose_logging\": false,\r\n  \"raid_debug_webhook_url\": \"\"\r\n}\r\nJSON\r\n    echo \"Created oxide/config/Cerebrust.json\"\r\nfi\r\n",
            "container": "ghcr.io/pterodactyl/installers:debian",
            "entrypoint": "bash"
        }
    },
    "variables": [
        {
            "name": "Query Port",
            "description": "Server Query Port. Can't be the same as Game's primary port.",
            "env_variable": "QUERY_PORT",
            "default_value": "27017",
            "user_viewable": true,
            "user_editable": false,
            "rules": "required|integer",
            "field_type": "text"
        },
        {
            "name": "RCON Port",
            "description": "Port for RCON connections.",
            "env_variable": "RCON_PORT",
            "default_value": "28016",
            "user_viewable": true,
            "user_editable": false,
            "rules": "required|integer",
            "field_type": "text"
        },
        {
            "name": "RCON Password",
            "description": "RCON access password.",
            "env_variable": "RCON_PASS",
            "default_value": "",
            "user_viewable": true,
            "user_editable": true,
            "rules": "required|regex:/^[\\w.-]*$/|max:64",
            "field_type": "text"
        },
        {
            "name": "App Port",
            "description": "Port for the Rust+ App. -1 to disable.",
            "env_variable": "APP_PORT",
            "default_value": "28082",
            "user_viewable": true,
            "user_editable": false,
            "rules": "required|integer",
            "field_type": "text"
        },
        {
            "name": "Modding Framework",
            "description": "Locked to oxide: the CerebRUST plugin is an Oxide plugin and will not load without it.",
            "env_variable": "FRAMEWORK",
            "default_value": "oxide",
            "user_viewable": false,
            "user_editable": false,
            "rules": "required|in:oxide",
            "field_type": "text"
        },
        {
            "name": "CerebRUST Ingest Token",
            "description": "Your server's CerebRUST ingest token, from the dashboard. It is written into oxide/config/Cerebrust.json on every start, so this field — not the file — is the source of truth. Leaving it blank blanks the token in the file and stops telemetry.",
            "env_variable": "CEREBRUST_TOKEN",
            "default_value": "",
            "user_viewable": true,
            "user_editable": true,
            "rules": "nullable|string|max:128",
            "field_type": "text"
        },
        {
            "name": "CerebRUST API",
            "description": "The CerebRUST API the plugin reports to. Leave it alone.",
            "env_variable": "CEREBRUST_API",
            "default_value": "https://api.cerebrust.xyz",
            "user_viewable": true,
            "user_editable": false,
            "rules": "required|url",
            "field_type": "text"
        },
        {
            "name": "CerebRUST Downloads",
            "description": "Where the plugin is downloaded from at install and at boot. Leave it alone.",
            "env_variable": "CEREBRUST_ASSETS",
            "default_value": "https://app.cerebrust.xyz",
            "user_viewable": false,
            "user_editable": false,
            "rules": "required|url",
            "field_type": "text"
        },
        {
            "name": "Auto-update the CerebRUST plugin",
            "description": "When 1, the latest Cerebrust.cs is downloaded on every start, the same way Oxide itself is. Set to 0 to pin whatever is in oxide/plugins and update it by hand.",
            "env_variable": "CEREBRUST_PLUGIN_UPDATE",
            "default_value": "1",
            "user_viewable": true,
            "user_editable": true,
            "rules": "required|in:0,1",
            "field_type": "text"
        }
    ]
}
