Adding set_env.js

This commit is contained in:
Dessalines 2018-12-01 23:10:42 -07:00
parent 21016e9429
commit bd729ce862
1 changed files with 17 additions and 0 deletions

17
server/ui/set_env.js Normal file
View File

@ -0,0 +1,17 @@
require('dotenv').config();
const fs = require('fs');
if (process.env.TORRENTS_CSV_ENDPOINT) {
let env_line = `export const endpoint = '${process.env.TORRENTS_CSV_ENDPOINT}';`;
fs.writeFile("src/env.ts", env_line, function (err) {
if (err) {
return console.log(err);
}
console.log("Found $TORRENTS_CSV_ENDPOINT, wrote src/env.ts");
console.log("\t" + env_line);
});
} else {
console.log("No $TORRENTS_CSV_ENDPOINT environment variable set, using http://0.0.0.0:8080");
}