updated format and lint scripts and applied them

This commit is contained in:
JJ Kasper
2018-06-01 16:52:12 -05:00
parent 53ac8a6793
commit 017a9993ee
58 changed files with 1711 additions and 1568 deletions

View File

@@ -1,24 +1,23 @@
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const secret = crypto.randomBytes(256).toString('hex');
const { NODE_ENV } = process.env;
let confFile = 'default.json';
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const crypto = require('crypto')
const secret = crypto.randomBytes(256).toString('hex')
const { NODE_ENV } = process.env
let confFile = 'default.json'
if(NODE_ENV && NODE_ENV.toLowerCase() === 'production') {
confFile = 'production.json';
if (NODE_ENV && NODE_ENV.toLowerCase() === 'production') {
confFile = 'production.json'
}
let config = require('./config/' + confFile);
let configPath = path.join(__dirname, 'config', confFile);
let config = require('./config/' + confFile)
let configPath = path.join(__dirname, 'config', confFile)
if(!config.authentication) {
config.authentication = { secret };
if (!config.authentication) {
config.authentication = { secret }
} else {
config.authentication.secret = secret;
config.authentication.secret = secret
}
fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n',
err => {
if(err) return console.error(err);
console.log('\nAuthentication secret successfully updated in', confFile);
}
);
fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', err => {
if (err) return console.error(err)
console.log('\nAuthentication secret successfully updated in', confFile)
})