16 lines
450 B
Bash
16 lines
450 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# If Vault init-keys exist, extract root token
|
|
if [ -f /vault/file/init-keys.json ]; then
|
|
export VAULT_TOKEN=$(tr -d ' \n' < /vault/file/init-keys.json | grep -o '"root_token":"[^"]*"' | cut -d'"' -f4)
|
|
echo "[API] Vault token loaded from init-keys.json"
|
|
fi
|
|
|
|
# Run migrations
|
|
node node_modules/knex/bin/cli.js migrate:latest --knexfile dist/db/knexfile.js
|
|
echo "[API] Migrations complete"
|
|
|
|
# Start server
|
|
exec node dist/index.js
|