|
|
@ -8,6 +8,10 @@ const RPC = require("./rpc");
|
|
|
|
const HK = require("./hk-util.js");
|
|
|
|
const HK = require("./hk-util.js");
|
|
|
|
const Core = require("./commands/core");
|
|
|
|
const Core = require("./commands/core");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Keys = require("./keys");
|
|
|
|
|
|
|
|
const Quota = require("./commands/quota");
|
|
|
|
|
|
|
|
const Util = require("./common-util");
|
|
|
|
|
|
|
|
|
|
|
|
const Store = require("./storage/file");
|
|
|
|
const Store = require("./storage/file");
|
|
|
|
const BlobStore = require("./storage/blob");
|
|
|
|
const BlobStore = require("./storage/blob");
|
|
|
|
const Workers = require("./workers/index");
|
|
|
|
const Workers = require("./workers/index");
|
|
|
@ -73,19 +77,49 @@ module.exports.create = function (config, cb) {
|
|
|
|
|
|
|
|
|
|
|
|
myDomain: config.myDomain,
|
|
|
|
myDomain: config.myDomain,
|
|
|
|
mySubdomain: config.mySubdomain, // only exists for the accounts integration
|
|
|
|
mySubdomain: config.mySubdomain, // only exists for the accounts integration
|
|
|
|
customLimits: config.customLimits || {},
|
|
|
|
customLimits: {},
|
|
|
|
// FIXME this attribute isn't in the default conf
|
|
|
|
// FIXME this attribute isn't in the default conf
|
|
|
|
// but it is referenced in Quota
|
|
|
|
// but it is referenced in Quota
|
|
|
|
domain: config.domain
|
|
|
|
domain: config.domain
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
(function () {
|
|
|
|
var custom = Env.customLimits;
|
|
|
|
var custom = config.customLimits;
|
|
|
|
for (var k in custom) {
|
|
|
|
var stored = Env.customLimits;
|
|
|
|
if (k.length === 44 && custom[k]) {
|
|
|
|
|
|
|
|
custom.origin = 'config';
|
|
|
|
Object.keys(custom).forEach(function (k) {
|
|
|
|
|
|
|
|
var unsafeKey = Keys.canonicalize(k);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!unsafeKey) {
|
|
|
|
|
|
|
|
Log.warn("INVALID_CUSTOM_LIMIT_ID", {
|
|
|
|
|
|
|
|
message: "A custom quota upgrade was provided via your config with an invalid identifier. It will be ignored.",
|
|
|
|
|
|
|
|
key: k,
|
|
|
|
|
|
|
|
value: custom[k],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stored[unsafeKey]) {
|
|
|
|
|
|
|
|
Log.warn("INVALID_CUSTOM_LIMIT_DUPLICATED", {
|
|
|
|
|
|
|
|
message: "A duplicated custom quota upgrade was provided via your config which would have overridden an existing value. It will be ignored.",
|
|
|
|
|
|
|
|
key: k,
|
|
|
|
|
|
|
|
value: custom[k],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Quota.isValidLimit(custom[k])) {
|
|
|
|
|
|
|
|
Log.warn("INVALID_CUSTOM_LIMIT_VALUE", {
|
|
|
|
|
|
|
|
message: "A custom quota upgrade was provided via your config with an invalid value. It will be ignored.",
|
|
|
|
|
|
|
|
key: k,
|
|
|
|
|
|
|
|
value: custom[k],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var limit = stored[unsafeKey] = Util.clone(custom[k]);
|
|
|
|
|
|
|
|
limit.origin = 'config';
|
|
|
|
|
|
|
|
});
|
|
|
|
}());
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
(function () {
|
|
|
|