Stuff
This commit is contained in:
parent
68e5c0fac4
commit
e732256cbf
2 changed files with 44 additions and 3 deletions
|
|
@ -36,6 +36,7 @@ print_header
|
|||
|
||||
KABOOT_DOMAIN=""
|
||||
AUTH_DOMAIN=""
|
||||
GEMINI_API_KEY=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
|
|
@ -47,12 +48,17 @@ while [[ $# -gt 0 ]]; do
|
|||
AUTH_DOMAIN="$2"
|
||||
shift 2
|
||||
;;
|
||||
--gemini-key)
|
||||
GEMINI_API_KEY="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help|-h)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --domain DOMAIN Main application domain (e.g., kaboot.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 ""
|
||||
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}
|
||||
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 ""
|
||||
print_step "Generating secrets..."
|
||||
|
||||
|
|
@ -137,6 +155,9 @@ OIDC_JWKS_URI=https://${AUTH_DOMAIN}/application/o/kaboot/jwks/
|
|||
CORS_ORIGIN=https://${KABOOT_DOMAIN}
|
||||
NODE_ENV=production
|
||||
LOG_REQUESTS=true
|
||||
|
||||
# System AI (optional - for quiz generation without user's own key)
|
||||
VITE_API_KEY=${GEMINI_API_KEY}
|
||||
EOF
|
||||
|
||||
print_success "Created .env"
|
||||
|
|
@ -195,9 +216,16 @@ fi
|
|||
|
||||
print_step "Building frontend with production URLs..."
|
||||
|
||||
VITE_API_URL="https://${KABOOT_DOMAIN}/api" \
|
||||
VITE_AUTHENTIK_URL="https://${AUTH_DOMAIN}" \
|
||||
npm run build --silent 2>/dev/null || npm run build
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
|
|
@ -210,6 +238,11 @@ echo -e "${BOLD}Configuration Summary${NC}"
|
|||
echo "────────────────────────────────────────────────────────────"
|
||||
echo -e " Main Domain: ${BLUE}https://${KABOOT_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 -e "${BOLD}Authentik Admin${NC}"
|
||||
echo "────────────────────────────────────────────────────────────"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue