forked from daveadams56/angular-todo-prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-env.mjs
More file actions
29 lines (26 loc) · 1.02 KB
/
Copy pathset-env.mjs
File metadata and controls
29 lines (26 loc) · 1.02 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
import { writeFile } from 'fs';
// Assume development
let targetPath = './src/environments/environment.ts';
let production = false;
if (process.env.DEVELOPMENT && process.env.DEVELOPMENT.toLowerCase() === 'false') {
targetPath = './src/environments/environment-prod.ts';
production = true;
}
const envConfigFile = `export const environment = {
AM_URL: '${process.env.AM_URL}',
REALM_PATH: '${process.env.REALM_PATH}',
WEB_OAUTH_CLIENT: '${process.env.WEB_OAUTH_CLIENT}',
JOURNEY_LOGIN: '${process.env.JOURNEY_LOGIN}',
JOURNEY_REGISTER: '${process.env.JOURNEY_REGISTER}',
API_URL: '${process.env.API_URL}',
APP_URL: '${process.env.APP_URL}',
production: '${production}'
};
`; console.log(`The file ${ targetPath } will be written with the following content: \n`);
console.log(envConfigFile); writeFile(targetPath, envConfigFile, function (err) {
if (err) {
throw console.error(err);
} else {
console.log(`Angular environment file generated correctly at ${targetPath} \n`);
}
});