diff --git a/api/.gitkeep b/api/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/config/config.php b/config/config.php new file mode 100755 index 0000000..0a395dc --- /dev/null +++ b/config/config.php @@ -0,0 +1,53 @@ +session()->start(); +$clientId = $app->session()->ensureClientId(); + +// Optionally expose a single global for templates if desired +$GLOBALS['client_id'] = $clientId; diff --git a/config/prod/db.php b/config/prod/db.php new file mode 100755 index 0000000..65c16d1 --- /dev/null +++ b/config/prod/db.php @@ -0,0 +1,96 @@ + 'pgsql', + 'host' => 'localhost', + 'port' => 5432, + 'dbname' => 'mydb', + + // optional: schema/search_path (commonly "public") + 'schema' => 'public', + + 'user' => 'myuser', + 'password' => 'secret', + + '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); +} + + ], +]; diff --git a/config/prod/domaindata.php b/config/prod/domaindata.php new file mode 100755 index 0000000..4479e5d --- /dev/null +++ b/config/prod/domaindata.php @@ -0,0 +1,12 @@ + 'pgsql', + 'host' => 'localhost', + 'port' => 5432, + 'dbname' => 'mydb', + + // optional: schema/search_path (commonly "public") + 'schema' => 'public', + + 'user' => 'myuser', + 'password' => 'secret', + + '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); +} diff --git a/config/staging/domaindata.php b/config/staging/domaindata.php new file mode 100755 index 0000000..4479e5d --- /dev/null +++ b/config/staging/domaindata.php @@ -0,0 +1,12 @@ +assets()->addStyle('/assets/app.css', 'early'); +$app->assets()->addScript('/assets/app.js', 'footer', true); + +$flash = $app->flash()->get(); +?> +
= htmlspecialchars(t('common.intro'), ENT_QUOTES) ?>
+ + += htmlspecialchars($GLOBALS['client_id'] ?? '', ENT_QUOTES) ?>Flash uses SessionManager, no direct globals.
+