mirror of https://github.com/status-im/codimd.git
refactor: fix lint warning on config
Signed-off-by: BoHong Li <a60814billy@gmail.com>
This commit is contained in:
parent
ee7eea6f91
commit
c532742206
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
|
const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
sourceURL: process.env.CMD_SOURCE_URL,
|
sourceURL: process.env.CMD_SOURCE_URL,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
|
const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
domain: process.env.HMD_DOMAIN,
|
domain: process.env.HMD_DOMAIN,
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const {merge} = require('lodash')
|
const { merge } = require('lodash')
|
||||||
const deepFreeze = require('deep-freeze')
|
const deepFreeze = require('deep-freeze')
|
||||||
const {Environment, Permission} = require('./enum')
|
const { Environment, Permission } = require('./enum')
|
||||||
const logger = require('../logger')
|
const logger = require('../logger')
|
||||||
const {getGitCommit, getGitHubURL} = require('./utils')
|
const { getGitCommit, getGitHubURL } = require('./utils')
|
||||||
|
|
||||||
const appRootPath = path.resolve(__dirname, '../../')
|
const appRootPath = path.resolve(__dirname, '../../')
|
||||||
const env = process.env.NODE_ENV || Environment.development
|
const env = process.env.NODE_ENV || Environment.development
|
||||||
|
@ -17,7 +17,7 @@ const debugConfig = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get version string from package.json
|
// Get version string from package.json
|
||||||
const {version, repository} = require(path.join(appRootPath, 'package.json'))
|
const { version, repository } = require(path.join(appRootPath, 'package.json'))
|
||||||
|
|
||||||
const commitID = getGitCommit(appRootPath)
|
const commitID = getGitCommit(appRootPath)
|
||||||
const sourceURL = getGitHubURL(repository.url, commitID || version)
|
const sourceURL = getGitHubURL(repository.url, commitID || version)
|
||||||
|
@ -159,8 +159,8 @@ if (Object.keys(process.env).toString().indexOf('HMD_') !== -1) {
|
||||||
if (config.sessionSecret === 'secret') {
|
if (config.sessionSecret === 'secret') {
|
||||||
logger.warn('Session secret not set. Using random generated one. Please set `sessionSecret` in your config.js file. All users will be logged out.')
|
logger.warn('Session secret not set. Using random generated one. Please set `sessionSecret` in your config.js file. All users will be logged out.')
|
||||||
config.sessionSecret = crypto.randomBytes(Math.ceil(config.sessionSecretLen / 2)) // generate crypto graphic random number
|
config.sessionSecret = crypto.randomBytes(Math.ceil(config.sessionSecretLen / 2)) // generate crypto graphic random number
|
||||||
.toString('hex') // convert to hexadecimal format
|
.toString('hex') // convert to hexadecimal format
|
||||||
.slice(0, config.sessionSecretLen) // return required number of characters
|
.slice(0, config.sessionSecretLen) // return required number of characters
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate upload upload providers
|
// Validate upload upload providers
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const {toBooleanConfig} = require('./utils')
|
const { toBooleanConfig } = require('./utils')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
debug: toBooleanConfig(process.env.DEBUG),
|
debug: toBooleanConfig(process.env.DEBUG),
|
||||||
|
|
Loading…
Reference in New Issue