mirror of
https://github.com/exchanges-lab/view.git
synced 2026-08-08 06:24:43 +08:00
Add build.sh for Cloudflare Pages env-based config injection
- Add build.sh that generates auth-config.js from environment variables (API_BASE_URL, GOOGLE_CLIENT_ID, ALLOWED_EMAILS) at build time - Move email whitelist from hardcoded login.html to window.ALLOWED_EMAILS in auth-config.js, so it can be configured via env vars - Reset auth-config.js to placeholder defaults in repo - Update README.md and README_CN.md deployment docs for both options Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-17
@@ -1,28 +1,14 @@
|
||||
window.API_CONFIG = { baseUrl: 'https://api-view.cathiefish.org' };
|
||||
|
||||
/**
|
||||
* Google OAuth Configuration
|
||||
* Configure your Google OAuth Client ID here
|
||||
* Access control is managed via the test users list in GCP Console
|
||||
*/
|
||||
window.API_CONFIG = { baseUrl: 'https://xxx.xxx.com' };
|
||||
|
||||
const AUTH_CONFIG = {
|
||||
// Client ID obtained from GCP Console
|
||||
// Replace with your actual Client ID
|
||||
clientId: '136939086552-bt28icv34nucmjna8hfndr6bopr5qcp4.apps.googleusercontent.com',
|
||||
|
||||
// Authentication success callback
|
||||
clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
|
||||
onSuccess: (user) => {
|
||||
console.log('Authentication successful:', user.email);
|
||||
// Additional logic can be added here, e.g. logging
|
||||
},
|
||||
|
||||
// Authentication failure callback
|
||||
onError: (error) => {
|
||||
console.error('Authentication error:', error);
|
||||
// Error handling logic can be added here
|
||||
}
|
||||
};
|
||||
|
||||
// Export configuration
|
||||
window.AUTH_CONFIG = AUTH_CONFIG;
|
||||
window.ALLOWED_EMAILS = ['your-email@gmail.com'];
|
||||
|
||||
Reference in New Issue
Block a user