This commit is contained in:
Joey Yakimowich-Payne 2026-01-15 19:38:44 -07:00
commit e732256cbf
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
2 changed files with 44 additions and 3 deletions

View file

@ -42,3 +42,11 @@ AUTHENTIK_BOOTSTRAP_TOKEN=
# OPTIONAL - Logging # OPTIONAL - Logging
# ============================================================================== # ==============================================================================
LOG_REQUESTS=false LOG_REQUESTS=false
# ==============================================================================
# OPTIONAL - System AI (Gemini API Key for quiz generation)
# If set, users can generate quizzes without providing their own API key.
# Get a key at: https://aistudio.google.com/apikey
# WARNING: This key is embedded in the frontend and visible to users.
# ==============================================================================
VITE_API_KEY=

View file

@ -36,6 +36,7 @@ print_header
KABOOT_DOMAIN="" KABOOT_DOMAIN=""
AUTH_DOMAIN="" AUTH_DOMAIN=""
GEMINI_API_KEY=""
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
@ -47,12 +48,17 @@ while [[ $# -gt 0 ]]; do
AUTH_DOMAIN="$2" AUTH_DOMAIN="$2"
shift 2 shift 2
;; ;;
--gemini-key)
GEMINI_API_KEY="$2"
shift 2
;;
--help|-h) --help|-h)
echo "Usage: $0 [OPTIONS]" echo "Usage: $0 [OPTIONS]"
echo "" echo ""
echo "Options:" echo "Options:"
echo " --domain DOMAIN Main application domain (e.g., kaboot.example.com)" echo " --domain DOMAIN Main application domain (e.g., kaboot.example.com)"
echo " --auth-domain DOMAIN Authentication domain (e.g., auth.example.com)" echo " --auth-domain DOMAIN Authentication domain (e.g., auth.example.com)"
echo " --gemini-key KEY Gemini API key for system AI (optional)"
echo " --help, -h Show this help message" echo " --help, -h Show this help message"
echo "" echo ""
echo "If options are not provided, you will be prompted for them." echo "If options are not provided, you will be prompted for them."
@ -98,6 +104,18 @@ if [ -z "$AUTH_DOMAIN" ]; then
AUTH_DOMAIN=${AUTH_DOMAIN:-$DEFAULT_AUTH} AUTH_DOMAIN=${AUTH_DOMAIN:-$DEFAULT_AUTH}
fi fi
echo ""
echo -e "${BOLD}System AI Configuration (Optional)${NC}"
echo "────────────────────────────────────────────────────────────"
echo "You can provide a Gemini API key to enable AI quiz generation"
echo "for all users without requiring them to set up their own key."
echo -e "${YELLOW}Note: This key will be embedded in the frontend and visible to users.${NC}"
echo ""
if [ -z "$GEMINI_API_KEY" ]; then
read -p "Enter Gemini API key (or press Enter to skip): " GEMINI_API_KEY
fi
echo "" echo ""
print_step "Generating secrets..." print_step "Generating secrets..."
@ -137,6 +155,9 @@ OIDC_JWKS_URI=https://${AUTH_DOMAIN}/application/o/kaboot/jwks/
CORS_ORIGIN=https://${KABOOT_DOMAIN} CORS_ORIGIN=https://${KABOOT_DOMAIN}
NODE_ENV=production NODE_ENV=production
LOG_REQUESTS=true LOG_REQUESTS=true
# System AI (optional - for quiz generation without user's own key)
VITE_API_KEY=${GEMINI_API_KEY}
EOF EOF
print_success "Created .env" print_success "Created .env"
@ -195,9 +216,16 @@ fi
print_step "Building frontend with production URLs..." print_step "Building frontend with production URLs..."
VITE_API_URL="https://${KABOOT_DOMAIN}/api" \ BUILD_ENV="VITE_API_URL=https://${KABOOT_DOMAIN} VITE_AUTHENTIK_URL=https://${AUTH_DOMAIN} VITE_OIDC_CLIENT_ID=kaboot-spa VITE_OIDC_APP_SLUG=kaboot"
VITE_AUTHENTIK_URL="https://${AUTH_DOMAIN}" \
npm run build --silent 2>/dev/null || npm run build if [ -n "$GEMINI_API_KEY" ]; then
BUILD_ENV="$BUILD_ENV VITE_API_KEY=$GEMINI_API_KEY"
print_success "System AI enabled with provided Gemini key"
else
print_warning "No Gemini API key provided - users must configure their own"
fi
eval "$BUILD_ENV npm run build --silent 2>/dev/null || $BUILD_ENV npm run build"
print_success "Frontend built" print_success "Frontend built"
@ -210,6 +238,11 @@ echo -e "${BOLD}Configuration Summary${NC}"
echo "────────────────────────────────────────────────────────────" echo "────────────────────────────────────────────────────────────"
echo -e " Main Domain: ${BLUE}https://${KABOOT_DOMAIN}${NC}" echo -e " Main Domain: ${BLUE}https://${KABOOT_DOMAIN}${NC}"
echo -e " Auth Domain: ${BLUE}https://${AUTH_DOMAIN}${NC}" echo -e " Auth Domain: ${BLUE}https://${AUTH_DOMAIN}${NC}"
if [ -n "$GEMINI_API_KEY" ]; then
echo -e " System AI: ${GREEN}Enabled${NC}"
else
echo -e " System AI: ${YELLOW}Disabled (users need own API key)${NC}"
fi
echo "" echo ""
echo -e "${BOLD}Authentik Admin${NC}" echo -e "${BOLD}Authentik Admin${NC}"
echo "────────────────────────────────────────────────────────────" echo "────────────────────────────────────────────────────────────"