Deploy: DB-Verbindung vor Upload pruefen (falscher DB_HOST brach die App), Warnung beim Anlegen-Formular behoben
This commit is contained in:
parent
ccfc257bbf
commit
27a267893e
3 changed files with 17 additions and 2 deletions
|
|
@ -24,7 +24,10 @@ Zugangsdaten stehen in `credentials.txt` im Projektwurzelverzeichnis (per
|
||||||
(Spiel-Zusammenfassungen, Zauber-/Liturgie-Summarien, SL-Material) bleiben
|
(Spiel-Zusammenfassungen, Zauber-/Liturgie-Summarien, SL-Material) bleiben
|
||||||
lokal in `RPG/7-Prep/…` bzw. am bisherigen Ablageort. Nichts davon in
|
lokal in `RPG/7-Prep/…` bzw. am bisherigen Ablageort. Nichts davon in
|
||||||
`APP_DIRECTORY` verschieben oder umleiten.
|
`APP_DIRECTORY` verschieben oder umleiten.
|
||||||
- **`DB_HOST`** (`mxzh.your-database.de`, Hetzner Managed MariaDB) + `DB_NAME`,
|
- **`DB_HOST`** (`mxzh.your-database.de`, Hetzner Managed MariaDB) – **nur
|
||||||
|
der Alias funktioniert**: `sql400.your-server.de` (bzw. der Webserver selbst)
|
||||||
|
hat keine Grants und liefert `1045 Access denied`. `deploy_app.sh` prüft die
|
||||||
|
Verbindung vor dem Upload und bricht sonst ab + `DB_NAME`,
|
||||||
`DB_USER`, `DB_PASSWORD` – erreichbar über Port 3306 von außen, DB derzeit
|
`DB_USER`, `DB_PASSWORD` – erreichbar über Port 3306 von außen, DB derzeit
|
||||||
ohne Tabellen. **Achtung:** In der Datei steht ein nachgestelltes Leerzeichen,
|
ohne Tabellen. **Achtung:** In der Datei steht ein nachgestelltes Leerzeichen,
|
||||||
vor Nutzung trimmen (`tr -d '[:space:]'`). Nicht `FTP_URL` als DB-Host nutzen.
|
vor Nutzung trimmen (`tr -d '[:space:]'`). Nicht `FTP_URL` als DB-Host nutzen.
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ function character_form_values(array $source): array
|
||||||
));
|
));
|
||||||
$values['hp_max'] = max(1, post_int('hp_max', (int) ($source['hp_max'] ?? 1)));
|
$values['hp_max'] = max(1, post_int('hp_max', (int) ($source['hp_max'] ?? 1)));
|
||||||
$values['hp_current'] = post_int('hp_current', (int) ($source['hp_current'] ?? $values['hp_max']));
|
$values['hp_current'] = post_int('hp_current', (int) ($source['hp_current'] ?? $values['hp_max']));
|
||||||
$acRaw = post_string('ac', $source['ac'] === null ? '' : (string) $source['ac']);
|
$acRaw = post_string('ac', ($source['ac'] ?? null) === null ? '' : (string) $source['ac']);
|
||||||
$values['ac'] = $acRaw === '' ? null : max(-10, min(30, (int) $acRaw));
|
$values['ac'] = $acRaw === '' ? null : max(-10, min(30, (int) $acRaw));
|
||||||
$values['attack_bonus'] = post_int('attack_bonus', (int) ($source['attack_bonus'] ?? 0));
|
$values['attack_bonus'] = post_int('attack_bonus', (int) ($source['attack_bonus'] ?? 0));
|
||||||
$values['gold_coins'] = post_int('gold_coins', (int) ($source['gold_coins'] ?? 0));
|
$values['gold_coins'] = post_int('gold_coins', (int) ($source['gold_coins'] ?? 0));
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,18 @@ return [
|
||||||
open(path, "w", encoding="utf-8").write(content)
|
open(path, "w", encoding="utf-8").write(content)
|
||||||
PY
|
PY
|
||||||
|
|
||||||
|
# Vorab-Check: Akzeptiert der DB-Server diese Zugangsdaten? Sonst würde der
|
||||||
|
# Upload eine vorher laufende App mit einer toten config.local.php ersetzen.
|
||||||
|
if command -v mysql >/dev/null 2>&1; then
|
||||||
|
DB_HOST_CLEAN="$(printf '%s' "${DB_HOST}" | tr -d '[:space:]')"
|
||||||
|
if ! MYSQL_PWD="${DB_PASSWORD}" mysql -h "${DB_HOST_CLEAN}" -u "${DB_USER}" \
|
||||||
|
--connect-timeout=8 -e 'SELECT 1' "${DB_NAME}" >/dev/null 2>&1; then
|
||||||
|
echo "FEHLER: DB-Verbindung zu ${DB_USER}@${DB_HOST_CLEAN}/${DB_NAME} schlägt fehl." >&2
|
||||||
|
echo " DB_HOST in credentials.txt prüfen (richtig ist mxzh.your-database.de)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
upload() {
|
upload() {
|
||||||
local src="$1" dst="$2"
|
local src="$1" dst="$2"
|
||||||
if [[ ${DRY_RUN} -eq 1 ]]; then
|
if [[ ${DRY_RUN} -eq 1 ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue