remove config.edition
we will replace this with feature flags
This commit is contained in:
@@ -170,7 +170,6 @@ function getConfig(callback) {
|
||||
mailFqdn: config.mailFqdn(),
|
||||
version: config.version(),
|
||||
isDemo: config.isDemo(),
|
||||
edition: config.edition(),
|
||||
memory: os.totalmem(),
|
||||
provider: config.provider(),
|
||||
cloudronName: allSettings[settings.CLOUDRON_NAME_KEY]
|
||||
|
||||
+1
-13
@@ -22,7 +22,6 @@ exports = module.exports = {
|
||||
setAdminFqdn: setAdminFqdn,
|
||||
version: version,
|
||||
database: database,
|
||||
edition: edition,
|
||||
|
||||
// these values are derived
|
||||
adminOrigin: adminOrigin,
|
||||
@@ -32,7 +31,6 @@ exports = module.exports = {
|
||||
mailFqdn: mailFqdn,
|
||||
hasIPv6: hasIPv6,
|
||||
|
||||
isManaged: isManaged,
|
||||
isDemo: isDemo,
|
||||
|
||||
// for testing resets to defaults
|
||||
@@ -68,8 +66,7 @@ function saveSync() {
|
||||
adminDomain: data.adminDomain,
|
||||
adminFqdn: data.adminFqdn,
|
||||
provider: data.provider,
|
||||
isDemo: data.isDemo,
|
||||
edition: data.edition
|
||||
isDemo: data.isDemo
|
||||
};
|
||||
|
||||
fs.writeFileSync(cloudronConfigFileName, JSON.stringify(conf, null, 4)); // functions are ignored by JSON.stringify
|
||||
@@ -95,7 +92,6 @@ function initConfig() {
|
||||
data.sysadminPort = 3001;
|
||||
data.ldapPort = 3002;
|
||||
data.dockerProxyPort = 3003;
|
||||
data.edition = '';
|
||||
|
||||
// keep in sync with start.sh
|
||||
data.database = {
|
||||
@@ -200,16 +196,8 @@ function provider() {
|
||||
return get('provider');
|
||||
}
|
||||
|
||||
function isManaged() {
|
||||
return edition() === 'hostingprovider';
|
||||
}
|
||||
|
||||
function hasIPv6() {
|
||||
const IPV6_PROC_FILE = '/proc/net/if_inet6';
|
||||
// on contabo, /proc/net/if_inet6 is an empty file. so just exists is not enough
|
||||
return fs.existsSync(IPV6_PROC_FILE) && fs.readFileSync(IPV6_PROC_FILE, 'utf8').trim().length !== 0;
|
||||
}
|
||||
|
||||
function edition() {
|
||||
return get('edition');
|
||||
}
|
||||
|
||||
@@ -135,8 +135,6 @@ function autoRegisterCloudron(adminDomain, callback) {
|
||||
assert.strictEqual(typeof adminDomain, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
if (!config.edition()) return callback();
|
||||
|
||||
const license = safe.JSON.parse(safe.fs.readFileSync(paths.LICENSE_FILE, 'utf8'));
|
||||
if (!license) return callback(new ProvisionError(ProvisionError.EXTERNAL_ERROR, 'Cannot read license'));
|
||||
if (typeof license.userId !== 'string' || typeof license.token !== 'string') return callback(new ProvisionError(ProvisionError.EXTERNAL_ERROR, 'Bad license'));
|
||||
@@ -349,7 +347,6 @@ function getStatus(callback) {
|
||||
cloudronName: cloudronName,
|
||||
adminFqdn: config.adminDomain() ? config.adminFqdn() : null,
|
||||
activated: activated,
|
||||
edition: config.edition()
|
||||
}, gProvisionStatus));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,8 +4,6 @@ exports = module.exports = {
|
||||
initialize: initialize,
|
||||
uninitialize: uninitialize,
|
||||
|
||||
isUnmanaged: isUnmanaged,
|
||||
|
||||
scope: scope,
|
||||
websocketAuth: websocketAuth
|
||||
};
|
||||
@@ -17,7 +15,6 @@ var accesscontrol = require('../accesscontrol.js'),
|
||||
clients = require('../clients.js'),
|
||||
ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy,
|
||||
ClientsError = clients.ClientsError,
|
||||
config = require('../config.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
LocalStrategy = require('passport-local').Strategy,
|
||||
passport = require('passport'),
|
||||
@@ -141,9 +138,3 @@ function websocketAuth(requiredScopes, req, res, next) {
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
function isUnmanaged(req, res, next) {
|
||||
if (!config.isManaged()) return next();
|
||||
|
||||
next(new HttpError(401, 'Managed instance does not permit this operation'));
|
||||
}
|
||||
|
||||
+3
-4
@@ -103,7 +103,6 @@ function initializeExpressSync() {
|
||||
var domainsReadScope = routes.accesscontrol.scope(accesscontrol.SCOPE_DOMAINS_READ);
|
||||
var domainsManageScope = routes.accesscontrol.scope(accesscontrol.SCOPE_DOMAINS_MANAGE);
|
||||
|
||||
const isUnmanaged = routes.accesscontrol.isUnmanaged;
|
||||
const verifyDomainLock = routes.domains.verifyDomainLock;
|
||||
const verifySettingsLock = routes.settings.verifySettingsLock;
|
||||
|
||||
@@ -277,9 +276,9 @@ function initializeExpressSync() {
|
||||
router.del ('/api/v1/mail/:domain/lists/:name', mailScope, routes.mail.removeList);
|
||||
|
||||
// feedback
|
||||
router.post('/api/v1/support/feedback', cloudronScope, isUnmanaged, routes.support.feedback);
|
||||
router.get ('/api/v1/support/remote_support', cloudronScope, isUnmanaged, routes.support.getRemoteSupport);
|
||||
router.post('/api/v1/support/remote_support', cloudronScope, isUnmanaged, routes.support.enableRemoteSupport);
|
||||
router.post('/api/v1/support/feedback', cloudronScope, routes.support.feedback);
|
||||
router.get ('/api/v1/support/remote_support', cloudronScope, routes.support.getRemoteSupport);
|
||||
router.post('/api/v1/support/remote_support', cloudronScope, routes.support.enableRemoteSupport);
|
||||
|
||||
// domain routes
|
||||
router.post('/api/v1/domains', domainsManageScope, routes.domains.add);
|
||||
|
||||
Reference in New Issue
Block a user