Skip to content

Remove config.php generation from setup, retain .env with input sanitization#4

Merged
itshypax merged 5 commits intomainfrom
copilot/remove-config-variables-setup
Nov 4, 2025
Merged

Remove config.php generation from setup, retain .env with input sanitization#4
itshypax merged 5 commits intomainfrom
copilot/remove-config-variables-setup

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 4, 2025

System configuration will now be managed via database after initial setup. The setup script should only create the .env file with essential credentials, not generate config.php.

Changes

Removed

  • config.php generation and all associated logic (48 config variables)
  • Form sections: Basis-Daten, Server-Daten, Roleplay-Daten, Funktionen & Einstellungen
  • Config variables: SYSTEM_NAME, SYSTEM_COLOR, SYSTEM_URL, SERVER_NAME, RP_ORGTYPE, CHAR_ID, ENOTF_USE_PIN, REGISTRATION_MODE, BASE_PATH, API_KEY, etc.
  • Associated validation for removed variables

Retained

  • .env file creation for database credentials (DB_HOST, DB_USER, DB_PASS, DB_NAME)
  • Discord OAuth credentials (DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET)
  • Git repository initialization and Composer installation flows

Security improvements

Added input sanitization to prevent .env injection:

function sanitizeEnvValue($value) {
    return trim(str_replace(["\r", "\n"], '', $value));
}

function formatEnvValue($value) {
    $value = sanitizeEnvValue($value);
    $value = str_replace(['\\', '"'], ['\\\\', '\\"'], $value);
    return '"' . $value . '"';
}

// All values are now properly escaped and quoted
$envContent = "DB_HOST=" . formatEnvValue($envConfig['DB_HOST']) . "\n";

Impact

  • Reduced setup.php from 1207 to 964 lines (20% reduction)
  • Simplified user flow: only essential credentials required during setup
  • Configuration UI moves to post-setup database admin panel
Original prompt

This section details on the original issue you should resolve

<issue_title>Config-Variablen aus setup entfernen</issue_title>
<issue_description>1. Die Config-Varaiblen und erstellung/überschreibung der config.php sollte entfernt werden. Da künftig die Config an sich über die Datenbank (nach dem Setup) stattfinden wird.
2. Die Erstellung der .env ist essenziell und sollte bestehen bleiben. </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits November 4, 2025 18:59
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
…ify message

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove config variables from setup process Remove config.php generation from setup, retain .env with input sanitization Nov 4, 2025
Copilot AI requested a review from itshypax November 4, 2025 19:10
@itshypax itshypax marked this pull request as ready for review November 4, 2025 19:54
@itshypax itshypax merged commit 8180c53 into main Nov 4, 2025
@itshypax itshypax deleted the copilot/remove-config-variables-setup branch November 4, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config-Variablen aus setup entfernen

2 participants