Path: blob/1.0-develop/app/Services/Servers/StartupCommandService.php
10276 views
<?php12namespace Pterodactyl\Services\Servers;34use Pterodactyl\Models\Server;56class StartupCommandService7{8/**9* Generates a startup command for a given server instance.10*/11public function handle(Server $server, bool $hideAllValues = false): string12{13$find = ['{{SERVER_MEMORY}}', '{{SERVER_IP}}', '{{SERVER_PORT}}'];14$replace = [$server->memory, $server->allocation->ip, $server->allocation->port];1516foreach ($server->variables as $variable) {17$find[] = '{{' . $variable->env_variable . '}}';18$replace[] = ($variable->user_viewable && !$hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]';19}2021return str_replace($find, $replace, $server->startup);22}23}242526