deploy
This commit is contained in:
14
docs/Umsetzungsanweisung/Old-Nexus/config/base_db.php
Normal file
14
docs/Umsetzungsanweisung/Old-Nexus/config/base_db.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Base database for Nexus core (users, settings, modules).
|
||||
* Sync copies the correct file into /config.
|
||||
*/
|
||||
|
||||
$path = __DIR__ . '/db_settings_basic.php';
|
||||
if (!file_exists($path)) {
|
||||
throw new RuntimeException('Missing base DB config: expected config/db_settings_basic.php');
|
||||
}
|
||||
|
||||
return require $path;
|
||||
42
docs/Umsetzungsanweisung/Old-Nexus/config/config.php
Executable file
42
docs/Umsetzungsanweisung/Old-Nexus/config/config.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// Basic error reporting (keep strict in dev)
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Required config files live in /config (sync copies staging/prod here)
|
||||
foreach (['domaindata.php', 'settings.php'] as $cfgFile) {
|
||||
$rootPath = __DIR__ . '/' . $cfgFile;
|
||||
|
||||
if (file_exists($rootPath)) {
|
||||
require_once $rootPath;
|
||||
} else {
|
||||
throw new \RuntimeException("Missing required config file: $cfgFile (expected $rootPath)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Asset versioning
|
||||
if (!defined('ASSET_VERSION')) {
|
||||
define('ASSET_VERSION', 'dev-' . date('Ymd-His'));
|
||||
}
|
||||
|
||||
// Primary domain + URL
|
||||
if (!defined('APP_DOMAIN_PRIMARY')) {
|
||||
define('APP_DOMAIN_PRIMARY', APP_DOMAIN_NAME);
|
||||
}
|
||||
if (!defined('APP_URL_PRIMARY')) {
|
||||
define('APP_URL_PRIMARY', 'https://' . APP_DOMAIN_PRIMARY);
|
||||
}
|
||||
|
||||
// API base (example)
|
||||
if (!defined('APP_API_BASE')) {
|
||||
define('APP_API_BASE', 'https://api.' . APP_DOMAIN_PRIMARY);
|
||||
}
|
||||
|
||||
// Feature toggles
|
||||
if (!defined('APP_DB_ENABLED')) {
|
||||
define('APP_DB_ENABLED', false); // set true to enable DB connection
|
||||
}
|
||||
70
docs/Umsetzungsanweisung/Old-Nexus/config/fileload.php
Executable file
70
docs/Umsetzungsanweisung/Old-Nexus/config/fileload.php
Executable file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// 1. Autoloader für App Namespace
|
||||
spl_autoload_register(function ($class) {
|
||||
// Repository Namespace zuerst prüfen (liegt außerhalb von /src/App)
|
||||
if (str_starts_with($class, 'App\\Repository\\')) {
|
||||
$prefix = 'App\\Repository\\';
|
||||
$base_dir = __DIR__ . '/../src/Repository/';
|
||||
} elseif (str_starts_with($class, 'App\\')) {
|
||||
$prefix = 'App\\';
|
||||
$base_dir = __DIR__ . '/../src/App/';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$len = strlen($prefix);
|
||||
|
||||
$relative_class = substr($class, $len);
|
||||
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
|
||||
// 2. Funktionen laden
|
||||
require_once __DIR__ . '/../src/App/functions.php';
|
||||
|
||||
// 3. Konfiguration laden (nur Root-Dateien; Sync kopiert staging/prod hierher)
|
||||
$domainFile = __DIR__ . '/domaindata.php';
|
||||
$settingsFile = __DIR__ . '/settings.php';
|
||||
$configFile = __DIR__ . '/db.php';
|
||||
$baseConfigFile = __DIR__ . '/base_db.php';
|
||||
$fallbackBaseConfig = __DIR__ . '/staging/db_settings_basic.php';
|
||||
$fallbackBaseConfigProd = __DIR__ . '/prod/db_settings_basic.php';
|
||||
|
||||
if (file_exists($domainFile)) {
|
||||
require_once $domainFile;
|
||||
}
|
||||
|
||||
if (file_exists($settingsFile)) {
|
||||
require_once $settingsFile;
|
||||
}
|
||||
|
||||
$dbConfig = [];
|
||||
if (file_exists($configFile)) {
|
||||
$dbConfig = require $configFile;
|
||||
}
|
||||
|
||||
// Base DB config (optional)
|
||||
$baseDbConfig = [];
|
||||
if (file_exists($baseConfigFile)) {
|
||||
$baseDbConfig = require $baseConfigFile;
|
||||
}
|
||||
if (empty($baseDbConfig) && file_exists($fallbackBaseConfig)) {
|
||||
$baseDbConfig = require $fallbackBaseConfig;
|
||||
}
|
||||
if (empty($baseDbConfig) && file_exists($fallbackBaseConfigProd)) {
|
||||
$baseDbConfig = require $fallbackBaseConfigProd;
|
||||
}
|
||||
|
||||
// Globales Config Objekt erstellen
|
||||
global $appConfig;
|
||||
$dbEnabled = defined('APP_DB_ENABLED') ? APP_DB_ENABLED : true;
|
||||
$baseDbEnabled = defined('APP_BASE_DB_ENABLED') ? APP_BASE_DB_ENABLED : false;
|
||||
$appConfig = new \App\Config($dbConfig, $dbEnabled, $baseDbConfig, $baseDbEnabled);
|
||||
|
||||
// App initialisieren
|
||||
\App\App::init($appConfig);
|
||||
93
docs/Umsetzungsanweisung/Old-Nexus/config/prod/db_settings_basic.php
Executable file
93
docs/Umsetzungsanweisung/Old-Nexus/config/prod/db_settings_basic.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* config/db.php
|
||||
*
|
||||
* - Choose ONE driver below (others stay commented).
|
||||
* - Each driver has its own config section.
|
||||
* - The file returns ONE normalized array used by Database::createPdo().
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 1) Driver selection (choose one)
|
||||
// ------------------------------------------------------------
|
||||
$driver = 'pgsql';
|
||||
// $driver = 'mysql';
|
||||
// $driver = 'sqlite';
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 2) Driver-specific configuration sections
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// ---- PostgreSQL (PDO driver: pgsql) -------------------------
|
||||
$pgsql = [
|
||||
'driver' => 'pgsql',
|
||||
'host' => 'db_nexus',
|
||||
'port' => 5432,
|
||||
'dbname' => 'nexus_live',
|
||||
|
||||
// optional: schema/search_path (commonly "public")
|
||||
'schema' => 'public',
|
||||
|
||||
'user' => 'nexusbasislive',
|
||||
'password' => 'JNr4REumUDPDjr4S9Lfq',
|
||||
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
];
|
||||
|
||||
// ---- MySQL / MariaDB (PDO driver: mysql) -------------------
|
||||
$mysql = [
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'port' => 3306,
|
||||
'dbname' => 'd0453540',
|
||||
'charset' => 'utf8mb4',
|
||||
|
||||
// Alternative to host/port:
|
||||
// 'unix_socket' => '/var/run/mysqld/mysqld.sock',
|
||||
|
||||
'user' => 'd0453540',
|
||||
'password' => 'P6jGRrSaX8QSiBMEJBL7',
|
||||
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
],
|
||||
];
|
||||
|
||||
// ---- SQLite (PDO driver: sqlite) ---------------------------
|
||||
$sqlite = [
|
||||
'driver' => 'sqlite',
|
||||
|
||||
// Use an absolute path in production, e.g. /var/app/data/app.sqlite
|
||||
// For demo/dev you can use a relative path.
|
||||
'path' => __DIR__ . '/../var/app.sqlite',
|
||||
|
||||
// SQLite ignores host/port/user/pass
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 3) Select and return config
|
||||
// ------------------------------------------------------------
|
||||
switch ($driver) {
|
||||
case 'pgsql':
|
||||
return $pgsql;
|
||||
|
||||
case 'mysql':
|
||||
return $mysql;
|
||||
|
||||
case 'sqlite':
|
||||
return $sqlite;
|
||||
|
||||
default:
|
||||
throw new RuntimeException('Unsupported DB driver in config/db.php: ' . $driver);
|
||||
}
|
||||
12
docs/Umsetzungsanweisung/Old-Nexus/config/prod/domaindata.php
Executable file
12
docs/Umsetzungsanweisung/Old-Nexus/config/prod/domaindata.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// Example: a single "brand" domain name.
|
||||
// In real deployments you might derive this from ENV or hostnames.
|
||||
if (!defined('APP_DOMAIN_NAME')) {
|
||||
define('APP_DOMAIN_NAME', 'nexus.kusche.berlin');
|
||||
}
|
||||
|
||||
if (!defined('APP_PREFIX')) {
|
||||
define('APP_PREFIX', 'miniapp');
|
||||
}
|
||||
26
docs/Umsetzungsanweisung/Old-Nexus/config/prod/settings.php
Executable file
26
docs/Umsetzungsanweisung/Old-Nexus/config/prod/settings.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
define('ASSET_VERSION', 'dev-' . date('Ymd-His'));
|
||||
define('APP_DOMAIN_PRIMARY', APP_DOMAIN_NAME);
|
||||
define('APP_URL_PRIMARY', 'https://' . APP_DOMAIN_PRIMARY);
|
||||
define('APP_API_BASE', 'https://api.' . APP_DOMAIN_PRIMARY);
|
||||
define('APP_DB_ENABLED', false); // set true to enable DB connection
|
||||
define('APP_DB_DEBUG', false);
|
||||
define('APP_DB_AUTO_INIT', true);
|
||||
define('APP_KEA_DB_VERSION', '2.6.3');
|
||||
define('APP_BASE_DB_ENABLED', true);
|
||||
define('APP_SEARCH_DEBUG', false);
|
||||
define('APP_AUTH_ENABLED', true);
|
||||
define('APP_OIDC_ISSUER', 'https://auth.kusche.berlin/realms/KuscheBerlin');
|
||||
define('APP_OIDC_AUTH_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/auth');
|
||||
define('APP_OIDC_TOKEN_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/token');
|
||||
define('APP_OIDC_USERINFO_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/userinfo');
|
||||
define('APP_OIDC_LOGOUT_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/logout');
|
||||
define('APP_OIDC_CLIENT_ID', 'nexus');
|
||||
define('APP_OIDC_CLIENT_SECRET', 'c0swC5wjBV4yimJHf2p3R9OjHOr7rhHs');
|
||||
define('APP_OIDC_REDIRECT_URI', 'https://nexus.kusche.berlin/auth/callback');
|
||||
define('APP_OIDC_POST_LOGOUT_REDIRECT_URI', 'https://nexus.kusche.berlin/');
|
||||
define('APP_OIDC_GROUP_CLAIM', 'groups');
|
||||
define('APP_OIDC_ADMIN_GROUP', 'appadmin');
|
||||
define('APP_OIDC_USER_GROUP', 'internalfamily');
|
||||
define('APP_DEBUG_TOOL', false);
|
||||
define('APP_AUTH_DEBUG', false);
|
||||
94
docs/Umsetzungsanweisung/Old-Nexus/config/staging/db_settings_basic.php
Executable file
94
docs/Umsetzungsanweisung/Old-Nexus/config/staging/db_settings_basic.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* config/db.php
|
||||
*
|
||||
* - Choose ONE driver below (others stay commented).
|
||||
* - Each driver has its own config section.
|
||||
* - The file returns ONE normalized array used by Database::createPdo().
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 1) Driver selection (choose one)
|
||||
// ------------------------------------------------------------
|
||||
$driver = 'pgsql';
|
||||
// $driver = 'mysql';
|
||||
// $driver = 'sqlite';
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 2) Driver-specific configuration sections
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// ---- PostgreSQL (PDO driver: pgsql) -------------------------
|
||||
$pgsql = [
|
||||
'driver' => 'pgsql',
|
||||
'host' => 'staging_db_nexus',
|
||||
'port' => 5432,
|
||||
'dbname' => 'nexus_staging',
|
||||
|
||||
// optional: schema/search_path (commonly "public")
|
||||
'schema' => 'public',
|
||||
|
||||
'user' => 'nexusbasisstg',
|
||||
'password' => '8HHtFt9ON6RkmwIS0c7U',
|
||||
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
];
|
||||
|
||||
// ---- MySQL / MariaDB (PDO driver: mysql) -------------------
|
||||
$mysql = [
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'port' => 3306,
|
||||
'dbname' => 'd0453540',
|
||||
'charset' => 'utf8mb4',
|
||||
|
||||
// Alternative to host/port:
|
||||
// 'unix_socket' => '/var/run/mysqld/mysqld.sock',
|
||||
|
||||
'user' => 'd0453540',
|
||||
'password' => 'P6jGRrSaX8QSiBMEJBL7',
|
||||
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
],
|
||||
];
|
||||
|
||||
// ---- SQLite (PDO driver: sqlite) ---------------------------
|
||||
$sqlite = [
|
||||
'driver' => 'sqlite',
|
||||
|
||||
// Use an absolute path in production, e.g. /var/app/data/app.sqlite
|
||||
// For demo/dev you can use a relative path.
|
||||
// blöder komment, der weg kann
|
||||
'path' => __DIR__ . '/../var/app.sqlite',
|
||||
|
||||
// SQLite ignores host/port/user/pass
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// 3) Select and return config
|
||||
// ------------------------------------------------------------
|
||||
switch ($driver) {
|
||||
case 'pgsql':
|
||||
return $pgsql;
|
||||
|
||||
case 'mysql':
|
||||
return $mysql;
|
||||
|
||||
case 'sqlite':
|
||||
return $sqlite;
|
||||
|
||||
default:
|
||||
throw new RuntimeException('Unsupported DB driver in config/db.php: ' . $driver);
|
||||
}
|
||||
12
docs/Umsetzungsanweisung/Old-Nexus/config/staging/domaindata.php
Executable file
12
docs/Umsetzungsanweisung/Old-Nexus/config/staging/domaindata.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// Example: a single "brand" domain name.
|
||||
// In real deployments you might derive this from ENV or hostnames.
|
||||
if (!defined('APP_DOMAIN_NAME')) {
|
||||
define('APP_DOMAIN_NAME', 'staging.nexus.kusche.berlin');
|
||||
}
|
||||
|
||||
if (!defined('APP_PREFIX')) {
|
||||
define('APP_PREFIX', 'miniapp');
|
||||
}
|
||||
26
docs/Umsetzungsanweisung/Old-Nexus/config/staging/settings.php
Executable file
26
docs/Umsetzungsanweisung/Old-Nexus/config/staging/settings.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
define('ASSET_VERSION', 'dev-' . date('Ymd-His'));
|
||||
define('APP_DOMAIN_PRIMARY', APP_DOMAIN_NAME);
|
||||
define('APP_URL_PRIMARY', 'https://' . APP_DOMAIN_PRIMARY);
|
||||
define('APP_API_BASE', 'https://api.' . APP_DOMAIN_PRIMARY);
|
||||
define('APP_DB_ENABLED', false); // legacy default DB disabled (modules handle their own DB)
|
||||
define('APP_DB_DEBUG', true);
|
||||
define('APP_DB_AUTO_INIT', true);
|
||||
define('APP_KEA_DB_VERSION', '2.6.3');
|
||||
define('APP_BASE_DB_ENABLED', true);
|
||||
define('APP_SEARCH_DEBUG', true);
|
||||
define('APP_AUTH_ENABLED', true);
|
||||
define('APP_OIDC_ISSUER', 'https://auth.kusche.berlin/realms/KuscheBerlin');
|
||||
define('APP_OIDC_AUTH_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/auth');
|
||||
define('APP_OIDC_TOKEN_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/token');
|
||||
define('APP_OIDC_USERINFO_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/userinfo');
|
||||
define('APP_OIDC_LOGOUT_ENDPOINT', 'https://auth.kusche.berlin/realms/KuscheBerlin/protocol/openid-connect/logout');
|
||||
define('APP_OIDC_CLIENT_ID', 'nexus');
|
||||
define('APP_OIDC_CLIENT_SECRET', 'c0swC5wjBV4yimJHf2p3R9OjHOr7rhHs');
|
||||
define('APP_OIDC_REDIRECT_URI', 'https://staging.nexus.kusche.berlin/auth/callback');
|
||||
define('APP_OIDC_POST_LOGOUT_REDIRECT_URI', 'https://staging.nexus.kusche.berlin/');
|
||||
define('APP_OIDC_GROUP_CLAIM', 'groups');
|
||||
define('APP_OIDC_ADMIN_GROUP', 'appadmin');
|
||||
define('APP_OIDC_USER_GROUP', 'internalfamily');
|
||||
define('APP_DEBUG_TOOL', true);
|
||||
define('APP_AUTH_DEBUG', true);
|
||||
Reference in New Issue
Block a user