forked from eyieko/landville-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-env.js
More file actions
23 lines (19 loc) · 725 Bytes
/
Copy pathset-env.js
File metadata and controls
23 lines (19 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const fs = require('fs');
// We grab the API_URL environment variable (or fall back to empty if not set)
const targetPath = './src/environments/environment.prod.ts';
const apiUrl = process.env.API_URL || 'https://landville-backend.onrender.com/api/v1';
const envConfigFile = `// Production config. Point these at your deployed backend before building.
export const environment = {
production: true,
profileUrl: '${apiUrl}/auth/profile/',
api_url: '${apiUrl}'
};
`;
console.log(`Updating environment.prod.ts with API_URL: ${apiUrl}`);
fs.writeFile(targetPath, envConfigFile, function (err) {
if (err) {
throw console.error(err);
} else {
console.log(`environment.prod.ts updated successfully.`);
}
});