Try to avoid crashing on launch

pull/126/head^2
tycrek 3 years ago
parent edf287c47a
commit b591727a50
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -15,7 +15,7 @@ import { path, log, getTrueHttp, getTrueDomain } from './utils';
//#region Setup - Run first time setup if using Docker (pseudo-process, setup will be run with docker exec)
import { doSetup } from './setup';
const configPath = path('config.json');
if (!fs.existsSync(configPath)) {
if (!fs.existsSync(configPath) || fs.readFileSync(configPath).toString().length === 0) {
doSetup();
// @ts-ignore
return;

@ -18,7 +18,7 @@ try {
var { useSsl, port, domain, isProxied, diskFilePath, s3bucket, s3endpoint, s3usePathStyle } = require('../config.json'); // skipcq: JS-0239, JS-0102
} catch (ex) {
// @ts-ignore
if (ex.code !== 'MODULE_NOT_FOUND') console.error(ex);
if (ex.code !== 'MODULE_NOT_FOUND' || Object.prototype.toString.call(ex).includes('Unexpected end of JSON input')) console.error(ex);
}
export function getTrueHttp() {

Loading…
Cancel
Save