Changed config from example to defaults file, merged with config.js
This commit is contained in:
parent
c466db2431
commit
fb746966af
@ -1,6 +1,6 @@
|
||||
### Installation
|
||||
|
||||
Copy ```config.example.js``` to ```config.js``` and review the configuration options. If this is an update, compare your ```config.js``` with ```config.example.js``` to see if anything has been added.
|
||||
Copy ```config.defaults.js``` to ```config.js``` and change as required. Any settings left out will use the value from ```config.defaults.js```.
|
||||
|
||||
To build the production version:
|
||||
```bash
|
||||
|
@ -2,6 +2,17 @@ const path = require('path');
|
||||
const ExpirationUnits = require('./lib/expirationunits');
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Copy this file and rename it to 'config.js' to customize the configuration.
|
||||
This will ensure your changes are not overwritten during updates.
|
||||
|
||||
Any settings not configured in your own 'config.js' will use the default
|
||||
defined in 'config.defaults.js'.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
module.exports = {
|
||||
port: 3000,
|
||||
|
||||
@ -26,7 +37,11 @@ module.exports = {
|
||||
length: 8,
|
||||
|
||||
maxExpiration: null
|
||||
|
||||
/*
|
||||
|
||||
To set a maximum expiration of 7 days:
|
||||
|
||||
maxExpiration: {
|
||||
units: ExpirationUnits.Days,
|
||||
value: 7
|
18
index.js
18
index.js
@ -1,10 +1,23 @@
|
||||
'use strict'
|
||||
const fs = require('fs');
|
||||
const merge = require('deepmerge');
|
||||
|
||||
|
||||
let configDefaults = require('./config.defaults');
|
||||
if (fs.existsSync('./config.js'))
|
||||
{
|
||||
let configChanges = require('./config');
|
||||
global.config = merge(configDefaults, configChanges);
|
||||
}
|
||||
else
|
||||
global.config = configDefaults;
|
||||
|
||||
|
||||
|
||||
|
||||
const config = require('./config');
|
||||
const Repository = require('./lib/repository');
|
||||
const NotificationWorker = require('./lib/workers/notification');
|
||||
|
||||
const fs = require('fs');
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const tus = require('tus-node-server');
|
||||
@ -18,6 +31,7 @@ const webpackDevMiddleware = require('webpack-dev-middleware');
|
||||
const webpackHotMiddleware = require('webpack-hot-middleware');
|
||||
const webpackConfigFactory = require('./webpack.config.js');
|
||||
|
||||
|
||||
(async () =>
|
||||
{
|
||||
try
|
||||
|
@ -1,4 +1,3 @@
|
||||
const config = require('../../config');
|
||||
const express = require('express');
|
||||
const asyncHandler = require('express-async-handler');
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const config = require('../../config');
|
||||
const express = require('express');
|
||||
const asyncHandler = require('express-async-handler');
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const config = require('../../config');
|
||||
const express = require('express');
|
||||
const asyncHandler = require('express-async-handler');
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
@ -2,7 +2,6 @@ const map = require('lodash/map');
|
||||
const retry = require('async-retry');
|
||||
const generate = require('nanoid/generate');
|
||||
const markdown = require('markdown').markdown;
|
||||
const config = require('../../config');
|
||||
const ExpirationUnits = require('../expirationunits');
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@ const map = require('lodash/map');
|
||||
const filter = require('lodash/filter');
|
||||
const resolvePath = require('resolve-path');
|
||||
const fs = require('mz/fs');
|
||||
const config = require('../../config');
|
||||
|
||||
|
||||
class Upload
|
||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -3132,6 +3132,11 @@
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz",
|
||||
"integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8="
|
||||
},
|
||||
"deepmerge": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.1.0.tgz",
|
||||
"integrity": "sha512-Q89Z26KAfA3lpPGhbF6XMfYAm3jIV3avViy6KOJ2JLzFbeWHOvPQUu5aSJIWXap3gDZC2y1eF5HXEPI2wGqgvw=="
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"body-parser": "^1.18.2",
|
||||
"cookie-parser": "^1.4.3",
|
||||
"debug": "^3.1.0",
|
||||
"deepmerge": "^2.1.0",
|
||||
"diskusage": "^0.2.4",
|
||||
"ejs": "^2.5.9",
|
||||
"email-templates": "^3.6.0",
|
||||
|
Loading…
Reference in New Issue
Block a user