2022-07-05 19:02:07 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import BConfig from "bcfg";
|
2022-07-19 22:31:15 +00:00
|
|
|
import { errorExit } from "./util.js";
|
2022-07-05 19:02:07 +00:00
|
|
|
|
|
|
|
const config = new BConfig("lumeweb-relay");
|
|
|
|
|
|
|
|
config.inject({
|
2022-07-19 22:31:15 +00:00
|
|
|
relayPort: 8080,
|
2022-07-05 19:02:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
config.load({
|
2022-07-19 22:31:15 +00:00
|
|
|
env: true,
|
|
|
|
argv: true,
|
2022-07-05 19:02:07 +00:00
|
|
|
});
|
|
|
|
try {
|
2022-07-19 22:31:15 +00:00
|
|
|
config.open("config.conf");
|
|
|
|
} catch (e) {}
|
2022-07-05 19:02:07 +00:00
|
|
|
|
2022-07-22 23:55:09 +00:00
|
|
|
for (const setting of ["domain", "afraid-username", "seed"]) {
|
2022-07-19 22:31:15 +00:00
|
|
|
if (!config.get(setting)) {
|
|
|
|
errorExit(`Required config option ${setting} not set`);
|
|
|
|
}
|
2022-07-05 19:02:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let usingPocketGateway = true;
|
|
|
|
|
|
|
|
export function usePocketGateway() {
|
2022-07-19 22:31:15 +00:00
|
|
|
return usingPocketGateway;
|
2022-07-05 19:02:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function updateUsePocketGateway(state: boolean): void {
|
2022-07-19 22:31:15 +00:00
|
|
|
usingPocketGateway = state;
|
2022-07-05 19:02:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default config;
|