torrents.csv/server/ui/set_env.js

18 lines
504 B
JavaScript
Raw Normal View History

2018-12-02 06:10:42 +00:00
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");
}