SPB Git

Repository Public MIT

smoke-env.sh 3.3 KB 67 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Astra8# File             : Scripts/smoke-env.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/orix-astra11# Created          : 2026-11-2112# Last Modified    : 2026-11-2213#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : Proprietary, all rights reserved (see license file)32# License File     : LICENSE33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Usage: source Scripts/smoke-env.sh        (do not pipe it: a pipe runs it in a subshell and the variables are lost)42# Loads the owner's existing development provider keys into the environment of the current shell for the live smoke tests.43# The values are read over SSH from the deployments that already use them; they are never printed, written to disk or committed.44_astra_fetch() {  # host, file, pattern -> KEY=value lines on stdout (kept in a variable by the caller, never shown)45  local out="" i46  for i in 1 2 3; do47    out="$(ssh -o ConnectTimeout=40 -o BatchMode=yes "$1" "grep -E '^($3)=' $2" 2>/dev/null)" && [ -n "$out" ] && break48    sleep 249  done50  printf '%s' "$out"51}52_astra_pick() { printf '%s\n' "$1" | grep -m1 "^$2=" | cut -d= -f2- | tr -d '"'"'"'\r\n'; }53_astra_a="$(_astra_fetch M4M64c '~/apps/chat-spboucher-ai/.env.production' 'OPENAI_API_KEY|ANTHROPIC_API_KEY|OPENROUTER_API_KEY|XAI_API_KEY|LOCAL_LLM_API_KEY')"54_astra_b="$(_astra_fetch M2U64 '~/vquant/.env' 'GEMINI_API_KEY')"55export OPENAI_API_KEY="$(_astra_pick "$_astra_a" OPENAI_API_KEY)"56export ANTHROPIC_API_KEY="$(_astra_pick "$_astra_a" ANTHROPIC_API_KEY)"57export OPENROUTER_API_KEY="$(_astra_pick "$_astra_a" OPENROUTER_API_KEY)"58export XAI_API_KEY="$(_astra_pick "$_astra_a" XAI_API_KEY)"59export GEMINI_API_KEY="$(_astra_pick "$_astra_b" GEMINI_API_KEY)"60export ASTRA_CUSTOM_KEY="$(_astra_pick "$_astra_a" LOCAL_LLM_API_KEY)"61export ASTRA_CUSTOM_BASE_URL="${ASTRA_CUSTOM_BASE_URL:-https://llm.spboucher.ai/v1}"62export ASTRA_LIVE_TESTS=163for v in OPENAI_API_KEY ANTHROPIC_API_KEY OPENROUTER_API_KEY XAI_API_KEY GEMINI_API_KEY ASTRA_CUSTOM_KEY; do64  if eval "[ -n \"\${$v:-}\" ]"; then echo "$v: loaded"; else echo "$v: MISSING"; fi65done66unset _astra_a _astra_b; unset -f _astra_fetch _astra_pick67
Files main
Menu

Theme