Files
go-socket/tests/config.sh
T
2026-03-30 10:42:11 +02:00

39 lines
856 B
Bash
Executable File

#!/bin/bash
# Shared config for all test scripts
BASE_URL="http://localhost:8080"
USER1_NAME="user_one"
USER1_PASS="password1234"
USER1_COLOR="255,0,0"
USER2_NAME="user_two"
USER2_PASS="password5678"
USER2_COLOR="0,0,255"
GROUP_NAME="TestGroup"
GROUP_COLOR="0,255,0"
# File to persist state between scripts
STATE_FILE="$(dirname "$0")/.state"
save_state() {
local key="$1" value="$2"
touch "$STATE_FILE"
# Remove existing key if present, then append
sed -i "/^${key}=/d" "$STATE_FILE"
echo "${key}=${value}" >> "$STATE_FILE"
}
load_state() {
local key="$1"
if [[ -f "$STATE_FILE" ]]; then
grep "^${key}=" "$STATE_FILE" | cut -d'=' -f2-
fi
}
decode_jwt_sub() {
local token="$1"
echo "$token" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['sub'])"
}