@cosmicdrift/kumiko-dev-server 0.322.0 → 0.324.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,12 +10,19 @@
10
10
  # changes BEFORE the app container starts — runProdApp's boot gate would
11
11
  # otherwise abort with SchemaDriftError.
12
12
  #
13
+ {{#stackNetworkDiscover}}
13
14
  # Network discovery: the _stack network is named `<dirname>_stack`
14
15
  # (compose convention). We discover it via `docker network ls` instead
15
16
  # of hard-coding.
17
+ {{/stackNetworkDiscover}}
18
+ {{#stackNetworkDirectory}}
19
+ # Network: the exact `<dirname>_stack` name of the compose project this
20
+ # script runs in (package.json#kumiko.deploy.stackNetwork = "directory").
21
+ {{/stackNetworkDirectory}}
16
22
 
17
23
  set -euo pipefail
18
24
 
25
+ {{#stackNetworkDiscover}}
19
26
  # `|| true` keeps `set -e`/`pipefail` from aborting the script when `grep`
20
27
  # finds no match (exit 1) — the empty-check below owns that case and prints
21
28
  # the actionable hint instead of a bare pipefail abort.
@@ -24,6 +31,14 @@ if [ -z "$STACK_NETWORK" ]; then
24
31
  echo "No _stack network found — compose project not running?" >&2
25
32
  exit 1
26
33
  fi
34
+ {{/stackNetworkDiscover}}
35
+ {{#stackNetworkDirectory}}
36
+ STACK_NETWORK="$(basename "$PWD")_stack"
37
+ if ! docker network inspect "$STACK_NETWORK" >/dev/null 2>&1; then
38
+ echo "Stack network '$STACK_NETWORK' not found — compose project not running?" >&2
39
+ exit 1
40
+ fi
41
+ {{/stackNetworkDirectory}}
27
42
 
28
43
  # Import .env as bash env. `set -a` marks subsequent variable assignments
29
44
  # as auto-export. Bash's built-in parser respects quotes/escapes like
@@ -34,13 +49,16 @@ set +a
34
49
 
35
50
  # DATABASE_URL assumes: db user = appName, db name = appName, host "db"
36
51
  # (compose-service-name), port 5432. Adjust to your stack if different.
52
+ {{#customDbUser}}
53
+ # The db user is overridden via package.json#kumiko.deploy.dbUser.
54
+ {{/customDbUser}}
37
55
  # Image tag pinned to :latest — swap to :${BUILD_SHA} for atomic deploys.
38
56
  #
39
57
  # Compose DATABASE_URL into the shell env and pass it to the container by
40
58
  # NAME (`-e DATABASE_URL`, no value) so the expanded password never appears
41
59
  # in `docker run`'s argv — otherwise it would be visible in `ps auxe` for
42
60
  # the duration of the migrate run.
43
- export DATABASE_URL="postgresql://{{appName}}:${DB_PASSWORD}@db:5432/{{appName}}"
61
+ export DATABASE_URL="postgresql://{{dbUser}}:${DB_PASSWORD}@db:5432/{{appName}}"
44
62
  docker run --rm \
45
63
  --network "$STACK_NETWORK" \
46
64
  -e DATABASE_URL \