feat: configure farm client identity and token

This commit is contained in:
wlx committed 2026-08-11 14:26:15 +08:00
1 parent 1b5e10bbd0
commit 54851fc191
6 files changed
+144 -2

No files matched your search

+7
View File
@@ -4,6 +4,7 @@ set -Eeuo pipefail
env_file="${1:-compose/.env}"
source_directory="${2:-/srv/ai-soulmate/sources/ai-soulmate-server}"
public_host="${3:-}"
client_id="${4:-farm-workstation-001}"
for required_command in git grep mktemp openssl; do
if ! command -v "$required_command" >/dev/null 2>&1; then
@@ -24,6 +25,10 @@ if [[ -z "$public_host" || ! "$public_host" =~ ^[A-Za-z0-9.-]+$ ]]; then
printf 'Provide the approved LAN IPv4 address or DNS name as argument 3.\n' >&2
exit 1
fi
if [[ -z "$client_id" || ! "$client_id" =~ ^[A-Za-z0-9._-]+$ ]]; then
printf 'Provide a client ID using letters, numbers, dot, underscore, or hyphen as argument 4.\n' >&2
exit 1
fi
source_branch="$(git -C "$source_directory" branch --show-current)"
source_commit="$(git -C "$source_directory" rev-parse HEAD)"
@@ -95,6 +100,8 @@ ensure_secret CDK_CODE_PEPPER
ensure_secret MLKJ_INTEGRATION_KEY
ensure_secret MLKJ_INTEGRATION_SECRET
ensure_secret PRINT_CLIENT_SHARED_TOKEN
set_value PRINT_DEFAULT_TARGET_CLIENT_ID "$client_id"
set_value PRINT_ALLOWED_CLIENT_ID "$client_id"
set_value OSS_PUBLIC_ENDPOINT "http://${public_host}:9000"
set_value CORS_ALLOWED_ORIGINS "http://${public_host},http://${public_host}:8080,http://${public_host}:8081,http://localhost:8080,http://127.0.0.1:8080"
+2
View File
@@ -93,6 +93,8 @@ CDK_CODE_PEPPER=$(random_secret)
MLKJ_INTEGRATION_KEY=$(random_secret)
MLKJ_INTEGRATION_SECRET=$(random_secret)
PRINT_CLIENT_SHARED_TOKEN=$(random_secret)
PRINT_DEFAULT_TARGET_CLIENT_ID=farm-workstation-001
PRINT_ALLOWED_CLIENT_ID=farm-workstation-001
OSS_PUBLIC_ENDPOINT=http://127.0.0.1:9000
CORS_ALLOWED_ORIGINS=http://localhost:8080,http://127.0.0.1:8080