Files
cloudron-box/src/custom.js
T

67 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-05-07 09:34:23 -07:00
'use strict';
2019-05-10 17:13:05 -07:00
let config = require('./config.js'),
debug = require('debug')('box:features'),
2019-05-10 11:19:13 -07:00
lodash = require('lodash'),
2019-05-07 09:34:23 -07:00
paths = require('./paths.js'),
safe = require('safetydance'),
yaml = require('js-yaml');
exports = module.exports = {
2019-05-10 11:19:13 -07:00
uiSpec: uiSpec,
2019-05-10 15:53:34 -07:00
spec: spec
2019-05-07 09:34:23 -07:00
};
2019-05-10 15:53:34 -07:00
const DEFAULT_SPEC = {
appstore: {
blacklist: [],
whitelist: null // null imples, not set. this is an object and not an array
},
2019-05-10 15:53:34 -07:00
backups: {
configurable: true
},
domains: {
2019-05-14 19:20:45 -07:00
dynamicDns: true,
changeDashboardDomain: true
2019-05-10 15:53:34 -07:00
},
subscription: {
configurable: true
2019-05-10 11:19:13 -07:00
},
support: {
2019-05-10 15:53:34 -07:00
email: 'support@cloudron.io',
2019-05-10 17:13:05 -07:00
remoteSupport: true,
ticketFormBody:
'Use this form to open support tickets. You can also write directly to [support@cloudron.io](mailto:support@cloudron.io).\n\n'
+ `* [Knowledge Base & App Docs](${config.webServerOrigin()}/documentation/apps/?support_view)\n`
+ `* [Custom App Packaging & API](${config.webServerOrigin()}/developer/packaging/?support_view)\n`
+ '* [Forum](https://forum.cloudron.io/)\n\n',
submitTickets: true
2019-05-10 11:19:13 -07:00
},
alerts: {
email: '',
notifyCloudronAdmins: false
2019-05-11 13:32:53 +02:00
},
footer: {
body: '&copy; 2019 [Cloudron](https://cloudron.io) [Forum <i class="fa fa-comments"></i>](https://forum.cloudron.io)'
2019-05-10 11:19:13 -07:00
}
};
2019-05-10 15:53:34 -07:00
const gSpec = (function () {
2019-05-07 09:34:23 -07:00
try {
2019-05-10 15:53:34 -07:00
if (!safe.fs.existsSync(paths.CUSTOM_FILE)) return DEFAULT_SPEC;
2019-05-10 11:19:13 -07:00
const c = yaml.safeLoad(safe.fs.readFileSync(paths.CUSTOM_FILE, 'utf8'));
2019-05-10 15:53:34 -07:00
return lodash.merge({}, DEFAULT_SPEC, c);
2019-05-07 09:34:23 -07:00
} catch (e) {
debug(`Error loading features file from ${paths.CUSTOM_FILE} : ${e.message}`);
2019-05-10 15:53:34 -07:00
return DEFAULT_SPEC;
2019-05-07 09:34:23 -07:00
}
})();
2019-05-10 15:53:34 -07:00
// flags sent to the UI. this is separate because we have values that are secret to the backend
2019-05-10 11:19:13 -07:00
function uiSpec() {
2019-05-10 15:53:34 -07:00
return gSpec;
2019-05-07 09:34:23 -07:00
}
2019-05-07 11:30:12 -07:00
2019-05-10 15:53:34 -07:00
function spec() {
return gSpec;
}