import { useState } from 'react'; import { useStartupVariables, useUpdateStartupVariable } from '../api/hooks.js'; import { STARTUP_MIRROR_HINTS } from './config/mirror-hints.js'; import { Badge, Button, Card, EmptyState, Spinner, useToast } from './ui.js'; /** * Pterodactyl egg startup variables (passwords, launch options, …). Values * are only visible to owner/server admin; changes apply on the next restart. */ // Controlled elsewhere in the panel (mission dropdown) or intentionally not // exposed; hidden here to avoid duplicate/confusing inputs. const HIDDEN_VARIABLES = new Set(['SCENARIO_ID', 'PUBLIC_ADDRESS']); export function StartupVarsCard({ slug }: { slug: string }) { const { data, isLoading, error } = useStartupVariables(slug, true); const update = useUpdateStartupVariable(slug); const [edits, setEdits] = useState>({}); const [revealed, setRevealed] = useState>({}); const toast = useToast(); const isSecret = (name: string) => /password|token|secret|key/i.test(name); const saveVariable = (envVariable: string) => { const value = edits[envVariable]; if (value === undefined) return; update.mutate( { key: envVariable, value }, { onSuccess: () => { setEdits((prev) => { const next = { ...prev }; delete next[envVariable]; return next; }); toast(`${envVariable} saved — applies on the next restart.`, 'ok'); }, onError: (updateError) => toast(updateError.message, 'danger'), }, ); }; return ( {isLoading ? ( ) : error ? (

{error.message}

) : !data || data.variables.length === 0 ? ( ) : (
    {data.variables .filter((variable) => !HIDDEN_VARIABLES.has(variable.envVariable)) .map((variable) => { const edited = edits[variable.envVariable]; const secret = isSecret(variable.envVariable) || isSecret(variable.name); const shown = revealed[variable.envVariable] ?? false; return (
  • {variable.name} {variable.envVariable} {STARTUP_MIRROR_HINTS[variable.envVariable] && ( templates {STARTUP_MIRROR_HINTS[variable.envVariable]} )}

    {variable.description && (

    {variable.description}

    )}
    setEdits({ ...edits, [variable.envVariable]: event.target.value }) } /> {secret && ( )} {variable.isEditable ? ( edited !== undefined && edited !== variable.value && ( ) ) : ( read-only )}
  • ); })}
)}

These are the same variables as Pterodactyl’s Startup tab; server passwords live here rather than in config.json. Variables marked as templating a config path are re-applied to config.json when the container boots, so they win over a direct file edit. Changes apply on the next server restart.

); }