1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-22 15:47:30 +00:00

Add config overrides file

This commit is contained in:
Cadence Ember 2020-11-20 18:27:38 +13:00
parent d806eb0426
commit ca8d26c722
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
5 changed files with 35 additions and 2 deletions

3
.gitignore vendored
View File

@ -6,4 +6,7 @@
# Auto-generated files # Auto-generated files
node_modules node_modules
# User configuration
/db /db
/config/config.js

15
config/config.sample.js Normal file
View File

@ -0,0 +1,15 @@
module.exports = {
/*
Copy this file to `config.js`, and add options here.
They'll override the options from `utils/constants.js`.
For example, uncommenting the next block would change the default instance.
*/
/*
user_settings: {
instance: {
default: "https://example.com"
}
}
*/
}

5
package-lock.json generated
View File

@ -442,6 +442,11 @@
"minipass": "^2.9.0" "minipass": "^2.9.0"
} }
}, },
"mixin-deep": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-2.0.1.tgz",
"integrity": "sha512-imbHQNRglyaplMmjBLL3V5R6Bfq5oM+ivds3SKgc6oRtzErEnBUUc5No11Z2pilkUvl42gJvi285xTNswcKCMA=="
},
"mkdirp": { "mkdirp": {
"version": "0.5.5", "version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",

View File

@ -13,6 +13,7 @@
"better-sqlite3": "^7.1.0", "better-sqlite3": "^7.1.0",
"cookie": "^0.4.1", "cookie": "^0.4.1",
"denque": "^1.4.1", "denque": "^1.4.1",
"mixin-deep": "^2.0.1",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#04cd72482574f689b78670b7f2b80209f5449a21" "pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#04cd72482574f689b78670b7f2b80209f5449a21"
} }

View File

@ -1,4 +1,6 @@
const constants = { const mixin = require("mixin-deep")
let constants = {
user_settings: { user_settings: {
instance: { instance: {
type: "string", type: "string",
@ -34,4 +36,11 @@ const constants = {
} }
} }
try {
const overrides = require("../config/config.js")
constants = mixin(constants, overrides)
} catch (e) {
console.log("Note: overrides file `config/config.js` ignored, file not found.")
}
module.exports = constants module.exports = constants