mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-12 19:37:29 +00:00
Add config overrides file
This commit is contained in:
parent
d806eb0426
commit
ca8d26c722
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,4 +6,7 @@
|
||||
|
||||
# Auto-generated files
|
||||
node_modules
|
||||
/db
|
||||
|
||||
# User configuration
|
||||
/db
|
||||
/config/config.js
|
||||
|
15
config/config.sample.js
Normal file
15
config/config.sample.js
Normal 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
5
package-lock.json
generated
@ -442,6 +442,11 @@
|
||||
"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": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
|
@ -13,6 +13,7 @@
|
||||
"better-sqlite3": "^7.1.0",
|
||||
"cookie": "^0.4.1",
|
||||
"denque": "^1.4.1",
|
||||
"mixin-deep": "^2.0.1",
|
||||
"node-fetch": "^2.6.0",
|
||||
"pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#04cd72482574f689b78670b7f2b80209f5449a21"
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
const constants = {
|
||||
const mixin = require("mixin-deep")
|
||||
|
||||
let constants = {
|
||||
user_settings: {
|
||||
instance: {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user