2018-12-02 06:10:42 +00:00
|
|
|
require('dotenv').config();
|
|
|
|
const fs = require('fs');
|
|
|
|
|
2018-12-25 23:19:16 +00:00
|
|
|
exports.setEnv = function() {
|
|
|
|
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");
|
|
|
|
}
|
2018-12-02 06:10:42 +00:00
|
|
|
}
|