Creating a better env strategy.
This commit is contained in:
parent
c460c958dd
commit
8678f92c5d
|
@ -25,7 +25,7 @@ fn main() {
|
||||||
// .index_file("index.html"),
|
// .index_file("index.html"),
|
||||||
)
|
)
|
||||||
.finish()
|
.finish()
|
||||||
}).bind("0.0.0.0:8080")
|
}).bind("localhost:8080")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,3 +27,5 @@ test/data/result.json
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
*.orig
|
*.orig
|
||||||
|
|
||||||
|
src/env.ts
|
||||||
|
|
|
@ -2,16 +2,10 @@ require('dotenv').config();
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
exports.setEnv = function() {
|
exports.setEnv = function() {
|
||||||
if (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 = '${process.env.TORRENTS_CSV_ENDPOINT}';`;
|
let env_line = `export const endpoint = '${endpoint}';`;
|
||||||
fs.writeFile("src/env.ts", env_line, function (err) {
|
fs.writeFile("src/env.ts", env_line, function (err) {
|
||||||
if (err) {
|
console.log("Wrote src/env.ts:");
|
||||||
return console.log(err);
|
console.log("\t" + env_line);
|
||||||
}
|
});
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export const endpoint = 'http://0.0.0.0:8080';
|
|
Loading…
Reference in New Issue