-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsetup_google_cloud.sh
More file actions
executable file
·78 lines (70 loc) · 3.15 KB
/
setup_google_cloud.sh
File metadata and controls
executable file
·78 lines (70 loc) · 3.15 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
#
# setup_frontend_google_cloud.sh
#
# Interactive script to configure your Angular frontend environment for
# Google Cloud / Firebase. It creates environment.ts in the specified path
# with user-provided Firebase and API endpoint settings.
# Flavor text
echo "============================================================"
echo " Welcome to the Olaf Frontend Setup for Google Cloud!"
echo " This script will configure your environment.ts file"
echo " so your Angular app connects to a remote Firebase project."
echo "============================================================"
echo
# Prompt user for each Firebase key
read -rp "Enter your Firebase projectId (e.g., olaf-web): " FIREBASE_PROJECT_ID
read -rp "Enter your Firebase appId (e.g., 1:123456:web:abcd1234): " FIREBASE_APP_ID
read -rp "Enter your Firebase storageBucket (e.g., myapp.appspot.com): " FIREBASE_STORAGE_BUCKET
read -rp "Enter your Firebase apiKey: " FIREBASE_API_KEY
read -rp "Enter your Firebase authDomain (e.g., myapp.firebaseapp.com): " FIREBASE_AUTH_DOMAIN
read -rp "Enter your Firebase messagingSenderId (e.g., 123456): " FIREBASE_MESSAGING_SENDER_ID
read -rp "Enter your Firebase measurementId (e.g., G-ABC123XYZ): " FIREBASE_MEASUREMENT_ID
echo
echo "Now let's configure your Production API endpoints..."
read -rp "Enter your chatAPIEndpoint: " CHAT_API_ENDPOINT
read -rp "Enter your l3chatAPIEndpoint: " L3CHAT_API_ENDPOINT
read -rp "Enter your nameMakerAPIEndpoint: " NAME_MAKER_API_ENDPOINT
read -rp "Enter your boxRequestApi: " BOX_REQUEST_API
read -rp "Enter your boxExecuteApi: " BOX_EXECUTE_API
read -rp "Enter your boxCloseApi: " BOX_CLOSE_API
read -rp "Enter your boxStatusApi: " BOX_STATUS_API
read -rp "Enter your boxUploadApi: " BOX_UPLOAD_API
read -rp "Enter your addFirebaseFileApi: " ADD_FIREBASE_FILE_API
read -rp "Enter your boxTerminalApi: " BOX_TERMINAL_API
# Directory where environment.ts should be placed
FRONTEND_ENV_PATH="frontend/src/environments"
mkdir -p "$FRONTEND_ENV_PATH"
# Write out the environment.ts file
cat <<EOF > "$FRONTEND_ENV_PATH/environment.ts"
export const environment = {
production: true,
firebase: {
projectId: '$FIREBASE_PROJECT_ID',
appId: '$FIREBASE_APP_ID',
storageBucket: '$FIREBASE_STORAGE_BUCKET',
apiKey: '$FIREBASE_API_KEY',
authDomain: '$FIREBASE_AUTH_DOMAIN',
messagingSenderId: '$FIREBASE_MESSAGING_SENDER_ID',
measurementId: '$FIREBASE_MEASUREMENT_ID',
},
// Production API Endpoints
chatAPIEndpoint: '$CHAT_API_ENDPOINT',
l3chatAPIEndpoint: '$L3CHAT_API_ENDPOINT',
nameMakerAPIEndpoint: '$NAME_MAKER_API_ENDPOINT',
// Box-related APIs
boxRequestApi: '$BOX_REQUEST_API',
boxExecuteApi: '$BOX_EXECUTE_API',
boxCloseApi: '$BOX_CLOSE_API',
boxStatusApi: '$BOX_STATUS_API',
boxUploadApi: '$BOX_UPLOAD_API',
addFirebaseFileApi: '$ADD_FIREBASE_FILE_API',
boxTerminalApi: '$BOX_TERMINAL_API',
};
EOF
echo
echo "============================================================"
echo "Your environment.ts file has been created at:"
echo " $FRONTEND_ENV_PATH/environment.ts"
echo "============================================================"
echo "Setup complete! You can now build or run your Angular app."