fixed setup breaking when running with no existing config

pull/22/head
tycrek 3 years ago
parent 20c939eb3e
commit 39433ebc93
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -25,10 +25,13 @@ if (require.main === module) {
const fs = require('fs-extra');
const prompt = require('prompt');
// Override default config with existing config to allow migrating configs
try {
const existingConfig = require('./config.json');
Object.keys(existingConfig).forEach((key) => Object.prototype.hasOwnProperty.call(config, key) && (config[key] = existingConfig[key]))
} catch (ex) { console.log(ex) }
} catch (ex) {
if (ex.code !== 'MODULE_NOT_FOUND') console.log(ex);
}
// Disabled the annoying "prompt: " prefix and removes colours
prompt.message = '';

@ -7,9 +7,15 @@ const token = require('./generators/token');
const zwsGen = require('./generators/zws');
const randomGen = require('./generators/random');
const gfyGen = require('./generators/gfycat');
const { useSsl, port, domain, isProxied, diskFilePath, saveWithDate, s3bucket, s3endpoint } = require('./config.json');
const { HTTP, HTTPS, KILOBYTES } = require('./MagicNumbers.json');
// Catch config.json not existing when running setup script
try {
var { useSsl, port, domain, isProxied, diskFilePath, saveWithDate, s3bucket, s3endpoint } = require('./config.json');
} catch (ex) {
if (ex.code !== 'MODULE_NOT_FOUND') console.log(ex);
}
const path = (...paths) => Path.join(__dirname, ...paths);
function getTrueHttp() {

Loading…
Cancel
Save