This repository was archived by the owner on Mar 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_universal_framework.sh
More file actions
executable file
·123 lines (101 loc) · 3.08 KB
/
setup_universal_framework.sh
File metadata and controls
executable file
·123 lines (101 loc) · 3.08 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# Step 1: Install necessary libraries
echo "Installing necessary libraries..."
npm install axios mongoose --save
# Step 2: Check if .env file exists, otherwise exit
if [ ! -f .env ]; then
echo ".env file is missing. Please ensure you have a .env file with all required credentials."
exit 1
fi
echo ".env file found."
# Step 3: Setup MongoDB Connection
echo "Creating MongoDB connection script..."
cat <<EOT > mongo.js
const mongoose = require('mongoose');
const connectDB = async () => {
try {
await mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log('MongoDB connected...');
} catch (err) {
console.error(err.message);
process.exit(1);
}
};
module.exports = connectDB;
EOT
echo "MongoDB connection setup complete."
# Step 4: Create NOMIC API Integration
echo "Creating NOMIC API integration script..."
cat <<EOT > nomic_api.js
const axios = require('axios');
const fetchDataFromNomic = async () => {
try {
const response = await axios.get('https://api.nomic.ai/v1/data', {
headers: {
'Authorization': \`Bearer \${process.env.NOMIC_API_KEY}\`
}
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
fetchDataFromNomic();
EOT
echo "NOMIC API integration script created."
# Step 5: Create KeyMate API Integration
echo "Creating KeyMate API integration script..."
cat <<EOT > keymate_api.js
const axios = require('axios');
const saveToKeyMateMemory = async (data) => {
try {
const response = await axios.post('https://api.keymate.ai/v1/insert', data, {
headers: {
'Authorization': \`Bearer \${process.env.KEYMATE_API_KEY}\`,
'Content-Type': 'application/json'
}
});
console.log('Data saved to KeyMate:', response.data);
} catch (error) {
console.error('Error saving data to KeyMate:', error);
}
};
saveToKeyMateMemory({ data: 'Sample Data' });
EOT
echo "KeyMate API integration script created."
# Step 6: Set up Google API Integration
echo "Setting up Google API integration..."
cat <<EOT > google_api.js
const { google } = require('googleapis');
const { OAuth2 } = google.auth;
const oAuth2Client = new OAuth2(
process.env.GOOGLE_API_CLIENT_ID,
process.env.GOOGLE_API_SECRET
);
oAuth2Client.setCredentials({
refresh_token: process.env.GOOGLE_REFRESH_TOKEN
});
const drive = google.drive({ version: 'v3', auth: oAuth2Client });
const listFiles = async () => {
const res = await drive.files.list({
pageSize: 10,
fields: 'files(id, name)',
});
console.log('Files:', res.data.files);
};
listFiles();
EOT
echo "Google API setup complete."
# Step 7: Vercel API Setup
echo "Setting up Vercel deployment script..."
cat <<EOT > deploy_vercel.sh
#!/bin/bash
vercel --token \$VERCEL_API_TOKEN
EOT
chmod +x deploy_vercel.sh
echo "Vercel deployment script created and made executable."
# Final message
echo "Universal Framework setup complete!"