-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·28 lines (23 loc) · 887 Bytes
/
build.sh
File metadata and controls
executable file
·28 lines (23 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Build script for Cloudflare Pages
# Generates auth-config.js from environment variables
#
# Set these in Cloudflare Pages > Settings > Environment Variables:
# API_BASE_URL - Backend API URL (e.g. https://api.yourdomain.com)
# GOOGLE_CLIENT_ID - Google OAuth Client ID
API_BASE_URL="${API_BASE_URL:-https://xxx.xxx.com}"
GOOGLE_CLIENT_ID="${GOOGLE_CLIENT_ID:-xxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com}"
cat > frontend/auth-config.js << JSEOF
window.API_CONFIG = { baseUrl: '${API_BASE_URL}' };
const AUTH_CONFIG = {
clientId: '${GOOGLE_CLIENT_ID}',
onSuccess: (user) => {
console.log('Authentication successful:', user.email);
},
onError: (error) => {
console.error('Authentication error:', error);
}
};
window.AUTH_CONFIG = AUTH_CONFIG;
JSEOF
echo "Generated auth-config.js with API_BASE_URL=${API_BASE_URL}"