-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-env.ts
More file actions
30 lines (25 loc) · 831 Bytes
/
set-env.ts
File metadata and controls
30 lines (25 loc) · 831 Bytes
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
//import { writeFile } from 'fs';
const fs = require('fs');
// Configure Angular `environment.ts` file path
const targetPath = './src/environments/environment.prod.ts';
// Load node modules
const colors = require('colors');
require('dotenv').config()
const urlSivnorm = process.env.URL_SIVNORM || null ;
const urlMatchvec = process.env.URL_MATCHVEC || null ;
const formsFree = process.env.FORMSFREE || null ;
const envConfigFile = `export const environment = {
production: true,
apiMatchvec: '${urlMatchvec}',
apiSivnorm: '${urlSivnorm}',
formsFree: '${formsFree}',
gpu: false
};
`;
fs.writeFile(targetPath, envConfigFile, function (err) {
if (err) {
throw console.error(err);
} else {
console.log(colors.magenta(`Angular environment.ts file generated correctly at ${targetPath} \n`));
}
});