scripts/deploy-prod: Ziel aus Wurzel-.env statt scripts/deploy.env
DEPLOY_TARGET wird jetzt aus der .env im Repo-Wurzelordner gelesen (die von der bestehenden .gitignore-Regel ohnehin ignoriert wird; Vite liest sie nicht, da dessen Env unter frontend/ liegt). scripts/deploy.env(.example) entfaellt; neue Vorlage .env.example im Wurzelordner. Argument hat weiterhin Vorrang, ~ bleibt fuer die Remote-Seite erhalten (kein source). .gitignore: eigene scripts/deploy.env-Zeile zurueckgenommen, Kommentar an der .env-Regel ergaenzt. README (de/en) entsprechend aktualisiert. Lokal verifiziert: Fallback liest aus Wurzel-.env, .env ignoriert, .env.example getrackt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
6b83af7d73
commit
350b0db7ee
@@ -0,0 +1,11 @@
|
||||
# Vorlage für .env — kopieren und anpassen:
|
||||
# cp .env.example .env
|
||||
#
|
||||
# .env liegt im Repo-Wurzelordner, ist git-ignoriert (enthält deinen Server/Pfad)
|
||||
# und wird von scripts/deploy-prod.sh benutzt, wenn KEIN Ziel als Argument
|
||||
# übergeben wird. Ein Argument hat immer Vorrang.
|
||||
#
|
||||
# Wert = rsync-Ziel (user@host:pfad). Das `~` wird auf der Remote-Seite
|
||||
# aufgelöst; Anführungszeichen sind optional. Keine Kommentare hinter dem Wert.
|
||||
|
||||
DEPLOY_TARGET=mih00@mih00.hostsharing.net:~/doms/werkbaum.javagil.de/htdocs-ssl
|
||||
+1
-2
@@ -57,11 +57,10 @@ frontend/node_modules/
|
||||
frontend/dist/
|
||||
|
||||
# === Geheimnisse / lokale Umgebung ===
|
||||
# .env hält u. a. DEPLOY_TARGET für scripts/deploy-prod.sh (Vorlage: .env.example)
|
||||
.env
|
||||
.env.local
|
||||
*.local
|
||||
# Deploy-Ziel (scripts/deploy-prod.sh) — lokal halten; Vorlage .example bleibt drin
|
||||
scripts/deploy.env
|
||||
|
||||
# === Temporäres ===
|
||||
tmp/
|
||||
|
||||
+2
-2
@@ -96,8 +96,8 @@ scripts/deploy-prod.sh mih00@mih00.hostsharing.net:~/doms/werkbaum.javagil.de/ht
|
||||
```
|
||||
|
||||
Das Ziel ist entweder dieses Argument oder — ohne Argument — die Variable
|
||||
`DEPLOY_TARGET` aus der **git-ignorierten** Datei `scripts/deploy.env` (Vorlage:
|
||||
`scripts/deploy.env.example`, einmal kopieren und den Pfad eintragen). Ein
|
||||
`DEPLOY_TARGET` aus der **git-ignorierten** Datei `.env` (Vorlage:
|
||||
`.env.example`, einmal kopieren und den Pfad eintragen). Ein
|
||||
Argument hat Vorrang.
|
||||
|
||||
Ohne `-y` zeigt es zuerst eine `--dry-run`-Vorschau und fragt nach. `rsync
|
||||
|
||||
@@ -94,8 +94,8 @@ scripts/deploy-prod.sh mih00@mih00.hostsharing.net:~/doms/werkbaum.javagil.de/ht
|
||||
```
|
||||
|
||||
The target is either this argument or — with no argument — the `DEPLOY_TARGET`
|
||||
variable from the **git-ignored** file `scripts/deploy.env` (template:
|
||||
`scripts/deploy.env.example`, copy it once and fill in the path). An argument
|
||||
variable from the **git-ignored** file `.env` (template:
|
||||
`.env.example`, copy it once and fill in the path). An argument
|
||||
takes precedence.
|
||||
|
||||
Without `-y` it first shows a `--dry-run` preview and asks for confirmation.
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
# -y ohne Rückfrage spiegeln (sonst erst Vorschau via --dry-run + Nachfrage)
|
||||
#
|
||||
# Das Ziel ist entweder das Argument ODER — wenn keins angegeben ist — die
|
||||
# Variable DEPLOY_TARGET aus der git-ignorierten Datei scripts/deploy.env
|
||||
# (Vorlage: scripts/deploy.env.example). Ein Argument hat Vorrang.
|
||||
# Variable DEPLOY_TARGET aus der git-ignorierten Datei .env im Repo-Wurzelordner
|
||||
# (Vorlage: .env.example). Ein Argument hat Vorrang.
|
||||
#
|
||||
# Beispiel (Hostsharing, direkt aufgeschaltete Domain werkbaum.javagil.de —
|
||||
# Web-Verzeichnis in `htdocs-ssl/`; als Subdomain unter einer anderen Domain
|
||||
@@ -51,8 +51,8 @@ done
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
# ---- Ziel: Argument hat Vorrang, sonst scripts/deploy.env (git-ignoriert) ----
|
||||
ENV_FILE="$ROOT/scripts/deploy.env"
|
||||
# ---- Ziel: Argument hat Vorrang, sonst DEPLOY_TARGET aus .env (git-ignoriert) ----
|
||||
ENV_FILE="$ROOT/.env"
|
||||
if [ -z "$TARGET" ] && [ -f "$ENV_FILE" ]; then
|
||||
# Bewusst NICHT via `source` lesen: bash würde bei `host:~/pfad` das ~ nach dem
|
||||
# ':' LOKAL expandieren. Stattdessen roh auslesen (letzte Definition gewinnt),
|
||||
@@ -62,12 +62,12 @@ if [ -z "$TARGET" ] && [ -f "$ENV_FILE" ]; then
|
||||
| tail -1 | sed -E 's/[[:space:]]+$//')"
|
||||
TARGET="${TARGET#\"}"; TARGET="${TARGET%\"}"
|
||||
TARGET="${TARGET#\'}"; TARGET="${TARGET%\'}"
|
||||
[ -n "$TARGET" ] && echo "==> Ziel aus scripts/deploy.env: ${TARGET}"
|
||||
[ -n "$TARGET" ] && echo "==> Ziel aus .env: ${TARGET}"
|
||||
fi
|
||||
|
||||
if [ -z "$TARGET" ]; then
|
||||
echo "Usage: $0 [-y] <rsync-ziel>" >&2
|
||||
echo " oder DEPLOY_TARGET in scripts/deploy.env setzen (Vorlage: scripts/deploy.env.example)" >&2
|
||||
echo " oder DEPLOY_TARGET in .env setzen (Vorlage: .env.example)" >&2
|
||||
echo " z.B. $0 mih00@mih00.hostsharing.net:~/doms/werkbaum.javagil.de/htdocs-ssl" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Vorlage für scripts/deploy.env — kopieren und anpassen:
|
||||
# cp scripts/deploy.env.example scripts/deploy.env
|
||||
#
|
||||
# scripts/deploy.env ist git-ignoriert (enthält deinen Server/Pfad) und wird von
|
||||
# scripts/deploy-prod.sh benutzt, wenn KEIN Ziel als Argument übergeben wird.
|
||||
# Ein Argument hat immer Vorrang.
|
||||
#
|
||||
# Wert = rsync-Ziel (user@host:pfad). Das `~` wird auf der Remote-Seite
|
||||
# aufgelöst; Anführungszeichen sind optional. Keine Kommentare hinter dem Wert.
|
||||
|
||||
DEPLOY_TARGET=mih00@mih00.hostsharing.net:~/doms/werkbaum.javagil.de/htdocs-ssl
|
||||
Reference in New Issue
Block a user