torrents.csv/server/ui/set_env.js

12 lines
397 B
JavaScript

require('dotenv').config();
const fs = require('fs');
exports.setEnv = function() {
let endpoint = (process.env.TORRENTS_CSV_ENDPOINT) ? process.env.TORRENTS_CSV_ENDPOINT : "http://localhost:8080";
let env_line = `export const endpoint = '${endpoint}';`;
fs.writeFile("src/env.ts", env_line, function (err) {
console.log("Wrote src/env.ts:");
console.log("\t" + env_line);
});
}