tune scripts
This commit is contained in:
parent
f4b75ebb7d
commit
ddc41779d0
|
|
@ -17,12 +17,23 @@ PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||
[ -f "$PROJECT_ROOT/.env" ] || { echo "missing $PROJECT_ROOT/.env (copy .env.example and fill it in)" >&2; exit 1; }
|
||||
set -a; . "$PROJECT_ROOT/.env"; set +a
|
||||
|
||||
# Pick the session string for the requested account, then aggressively drop all
|
||||
# suffixed TELEGRAM_SESSION_STRING_* vars from the environment so telegram-mcp's
|
||||
# auto-discovery (runtime.py: _discover_accounts) does NOT load the other
|
||||
# account as a secondary client on this server. Each MCP server must expose
|
||||
# exactly one identity = "default".
|
||||
case "$ACCOUNT" in
|
||||
usulsu) export TELEGRAM_SESSION_STRING="${TELEGRAM_SESSION_STRING:-}" ;;
|
||||
helper) export TELEGRAM_SESSION_STRING="${TELEGRAM_SESSION_STRING_HELPER:-}" ;;
|
||||
usulsu) SESSION="${TELEGRAM_SESSION_STRING:-}" ;;
|
||||
helper) SESSION="${TELEGRAM_SESSION_STRING_HELPER:-}" ;;
|
||||
*) echo "account must be 'usulsu' or 'helper'" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
while IFS='=' read -r name _; do
|
||||
case "$name" in TELEGRAM_SESSION_STRING_*|TELEGRAM_SESSION_NAME_*) unset "$name" ;; esac
|
||||
done < <(env)
|
||||
|
||||
export TELEGRAM_SESSION_STRING="$SESSION"
|
||||
|
||||
if [ -z "${TELEGRAM_API_ID:-}" ] || [ -z "${TELEGRAM_API_HASH:-}" ]; then
|
||||
echo "TELEGRAM_API_ID / TELEGRAM_API_HASH missing in $PROJECT_ROOT/.env" >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue