Creating a better env strategy.

This commit is contained in:
Dessalines 2019-02-20 18:35:27 -08:00
parent c460c958dd
commit 8678f92c5d
4 changed files with 9 additions and 14 deletions

View File

@ -25,7 +25,7 @@ fn main() {
// .index_file("index.html"),
)
.finish()
}).bind("0.0.0.0:8080")
}).bind("localhost:8080")
.unwrap()
.run();
}

View File

@ -27,3 +27,5 @@ test/data/result.json
package-lock.json
*.orig
src/env.ts

View File

@ -2,16 +2,10 @@ require('dotenv').config();
const fs = require('fs');
exports.setEnv = function() {
if (process.env.TORRENTS_CSV_ENDPOINT) {
let env_line = `export const endpoint = '${process.env.TORRENTS_CSV_ENDPOINT}';`;
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) {
if (err) {
return console.log(err);
}
console.log("Found $TORRENTS_CSV_ENDPOINT, wrote src/env.ts");
console.log("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");
}
}

View File

@ -1 +0,0 @@
export const endpoint = 'http://0.0.0.0:8080';