Alexaの認証を延長するもの
This commit is contained in:
35
alexa-api/alexa-cookie-deploy.sh
Normal file
35
alexa-api/alexa-cookie-deploy.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 /tmp/alexa-api.env" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
SRC_ENV="$1"
|
||||
DEST_ENV="/home/claude/alexa-api/.env"
|
||||
DEST_DIR="/home/claude/alexa-api"
|
||||
COMPOSE_FILE="/home/claude/alexa-api/docker-compose.yml"
|
||||
|
||||
if [[ "$SRC_ENV" != /tmp/* ]]; then
|
||||
echo "source env must be under /tmp" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ ! -f "$SRC_ENV" ]]; then
|
||||
echo "source env not found: $SRC_ENV" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -q '^ALEXA_COOKIE=' "$SRC_ENV" || {
|
||||
echo "ALEXA_COOKIE entry not found in $SRC_ENV" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
install -d -m 755 "$DEST_DIR"
|
||||
install -m 600 "$SRC_ENV" "$DEST_ENV"
|
||||
|
||||
docker compose --env-file "$DEST_ENV" -f "$COMPOSE_FILE" restart
|
||||
|
||||
rm -f "$SRC_ENV"
|
||||
echo "alexa cookie deployed"
|
||||
Reference in New Issue
Block a user