17 lines
436 B
TypeScript
Raw Normal View History

2022-09-03 01:14:28 +02:00
import * as util from "./util.ts";
2022-09-02 22:24:33 +02:00
function get(key: string, def?: string): string {
const value = Deno.env.get(key) ?? def;
if (value !== undefined) {
return value;
}
throw new Error(`Missing environment variable '${key}'.`);
}
export default {
2022-09-03 01:14:28 +02:00
debug: util.parseBool(get("DEBUG", "0")),
2022-09-02 22:24:33 +02:00
hostname: get("HOSTNAME", "127.0.0.1"),
port: parseInt(get("PORT", "8080")),
signKey: get("SIGN_KEY"),
};