Update Dockerfile
Browse files- Dockerfile +399 -13
Dockerfile
CHANGED
|
@@ -2,19 +2,405 @@ FROM n8nio/n8n:latest
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
| 5 |
-
# ==============================
|
| 6 |
-
#
|
| 7 |
-
# ==============================
|
| 8 |
-
RUN cat /usr/local/lib/node_modules/n8n/node_modules/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
# ==============================
|
| 11 |
-
#
|
| 12 |
-
# ==============================
|
| 13 |
-
RUN cat /usr/local/lib/node_modules/n8n/dist/license.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
# ==============================
|
| 16 |
-
# 启动
|
| 17 |
-
# ==============================
|
| 18 |
USER node
|
| 19 |
-
|
| 20 |
-
RUN ["exit"]
|
|
|
|
| 2 |
|
| 3 |
USER root
|
| 4 |
|
| 5 |
+
# ==============================
|
| 6 |
+
# 1. 覆盖 license-state.js(你提供的原版 + 全功能解锁)
|
| 7 |
+
# ==============================
|
| 8 |
+
RUN cat > /usr/local/lib/node_modules/n8n/node_modules/@n8n/backend-common/dist/license-state.js <<'EOF'
|
| 9 |
+
"use strict";
|
| 10 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 11 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 12 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 13 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 14 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 15 |
+
};
|
| 16 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 17 |
+
exports.LicenseState = void 0;
|
| 18 |
+
const constants_1 = require("@n8n/constants");
|
| 19 |
+
const di_1 = require("@n8n/di");
|
| 20 |
+
const n8n_workflow_1 = require("n8n-workflow");
|
| 21 |
+
class ProviderNotSetError extends n8n_workflow_1.UnexpectedError {
|
| 22 |
+
constructor() {
|
| 23 |
+
super('Cannot query license state because license provider has not been set');
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
let LicenseState = class LicenseState {
|
| 27 |
+
constructor() {
|
| 28 |
+
this.licenseProvider = null;
|
| 29 |
+
}
|
| 30 |
+
setLicenseProvider(provider) { this.licenseProvider = provider; }
|
| 31 |
+
assertProvider() {}
|
| 32 |
+
isLicensed(feature) { return true; }
|
| 33 |
+
getValue(feature) { return 99999999; }
|
| 34 |
+
isCustomRolesLicensed() { return true; }
|
| 35 |
+
isDynamicCredentialsLicensed() { return true; }
|
| 36 |
+
isPersonalSpacePolicyLicensed() { return true; }
|
| 37 |
+
isSharingLicensed() { return true; }
|
| 38 |
+
isLogStreamingLicensed() { return true; }
|
| 39 |
+
isLdapLicensed() { return true; }
|
| 40 |
+
isSamlLicensed() { return true; }
|
| 41 |
+
isOidcLicensed() { return true; }
|
| 42 |
+
isMFAEnforcementLicensed() { return true; }
|
| 43 |
+
isApiKeyScopesLicensed() { return true; }
|
| 44 |
+
isAiAssistantLicensed() { return true; }
|
| 45 |
+
isAskAiLicensed() { return true; }
|
| 46 |
+
isAiCreditsLicensed() { return true; }
|
| 47 |
+
isAdvancedExecutionFiltersLicensed() { return true; }
|
| 48 |
+
isAdvancedPermissionsLicensed() { return true; }
|
| 49 |
+
isDebugInEditorLicensed() { return true; }
|
| 50 |
+
isBinaryDataS3Licensed() { return true; }
|
| 51 |
+
isMultiMainLicensed() { return true; }
|
| 52 |
+
isVariablesLicensed() { return true; }
|
| 53 |
+
isSourceControlLicensed() { return true; }
|
| 54 |
+
isExternalSecretsLicensed() { return true; }
|
| 55 |
+
isAPIDisabled() { return false; }
|
| 56 |
+
isWorkerViewLicensed() { return true; }
|
| 57 |
+
isProjectRoleAdminLicensed() { return true; }
|
| 58 |
+
isProjectRoleEditorLicensed() { return true; }
|
| 59 |
+
isProjectRoleViewerLicensed() { return true; }
|
| 60 |
+
isCustomNpmRegistryLicensed() { return true; }
|
| 61 |
+
isFoldersLicensed() { return true; }
|
| 62 |
+
isInsightsSummaryLicensed() { return true; }
|
| 63 |
+
isInsightsDashboardLicensed() { return true; }
|
| 64 |
+
isInsightsHourlyDataLicensed() { return true; }
|
| 65 |
+
isWorkflowDiffsLicensed() { return true; }
|
| 66 |
+
isDataRedactionLicensed() { return true; }
|
| 67 |
+
isProvisioningLicensed() { return true; }
|
| 68 |
+
getMaxUsers() { return 99999999; }
|
| 69 |
+
getMaxActiveWorkflows() { return 99999999; }
|
| 70 |
+
getMaxVariables() { return 99999999; }
|
| 71 |
+
getMaxAiCredits() { return 99999999; }
|
| 72 |
+
getWorkflowHistoryPruneQuota() { return 99999999; }
|
| 73 |
+
getInsightsMaxHistory() { return 3650; }
|
| 74 |
+
getInsightsRetentionMaxAge() { return 3650; }
|
| 75 |
+
getInsightsRetentionPruneInterval() { return 1; }
|
| 76 |
+
getMaxTeamProjects() { return 99999999; }
|
| 77 |
+
getMaxWorkflowsWithEvaluations() { return 99999999; }
|
| 78 |
+
};
|
| 79 |
+
exports.LicenseState = LicenseState;
|
| 80 |
+
exports.LicenseState = LicenseState = __decorate([
|
| 81 |
+
(0, di_1.Service)()
|
| 82 |
+
], LicenseState);
|
| 83 |
+
EOF
|
| 84 |
|
| 85 |
+
# ==============================
|
| 86 |
+
# 2. 覆盖 license.js(你提供的原版 + 只改一行 isLicensed 永久返回 true)
|
| 87 |
+
# ==============================
|
| 88 |
+
RUN cat > /usr/local/lib/node_modules/n8n/dist/license.js <<'EOF'
|
| 89 |
+
"use strict";
|
| 90 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
| 91 |
+
if (k2 === undefined) k2 = k;
|
| 92 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
| 93 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
| 94 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
| 95 |
+
}
|
| 96 |
+
Object.defineProperty(o, k2, desc);
|
| 97 |
+
}) : (function(o, m, k, k2) {
|
| 98 |
+
if (k2 === undefined) k2 = k;
|
| 99 |
+
o[k2] = m[k];
|
| 100 |
+
}));
|
| 101 |
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
| 102 |
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
| 103 |
+
}) : function(o, v) {
|
| 104 |
+
o["default"] = v;
|
| 105 |
+
});
|
| 106 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 107 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 108 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 109 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 110 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 111 |
+
};
|
| 112 |
+
var __importStar = (this && this.__importStar) || (function () {
|
| 113 |
+
var ownKeys = function(o) {
|
| 114 |
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
| 115 |
+
var ar = [];
|
| 116 |
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
| 117 |
+
return ar;
|
| 118 |
+
};
|
| 119 |
+
return ownKeys(o);
|
| 120 |
+
};
|
| 121 |
+
return function (mod) {
|
| 122 |
+
if (mod && mod.__esModule) return mod;
|
| 123 |
+
var result = {};
|
| 124 |
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
| 125 |
+
__setModuleDefault(result, mod);
|
| 126 |
+
return result;
|
| 127 |
+
};
|
| 128 |
+
})();
|
| 129 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 130 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 131 |
+
};
|
| 132 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 133 |
+
exports.License = void 0;
|
| 134 |
+
const backend_common_1 = require("@n8n/backend-common");
|
| 135 |
+
const config_1 = require("@n8n/config");
|
| 136 |
+
const constants_1 = require("@n8n/constants");
|
| 137 |
+
const db_1 = require("@n8n/db");
|
| 138 |
+
const decorators_1 = require("@n8n/decorators");
|
| 139 |
+
const di_1 = require("@n8n/di");
|
| 140 |
+
const license_sdk_1 = require("@n8n_io/license-sdk");
|
| 141 |
+
const n8n_core_1 = require("n8n-core");
|
| 142 |
+
const license_metrics_service_1 = require("./metrics/license-metrics.service");
|
| 143 |
+
const constants_2 = require("./constants");
|
| 144 |
+
const LICENSE_RENEWAL_DISABLED_WARNING = 'Automatic license renewal is disabled. The license will not renew automatically, and access to licensed features may be lost!';
|
| 145 |
+
let License = class License {
|
| 146 |
+
constructor(logger, instanceSettings, settingsRepository, licenseMetricsService, globalConfig) {
|
| 147 |
+
this.logger = logger;
|
| 148 |
+
this.instanceSettings = instanceSettings;
|
| 149 |
+
this.settingsRepository = settingsRepository;
|
| 150 |
+
this.licenseMetricsService = licenseMetricsService;
|
| 151 |
+
this.globalConfig = globalConfig;
|
| 152 |
+
this.isShuttingDown = false;
|
| 153 |
+
this.refreshCallbacks = [];
|
| 154 |
+
this.logger = this.logger.scoped('license');
|
| 155 |
+
}
|
| 156 |
+
async init({ forceRecreate = false, isCli = false, } = {}) {
|
| 157 |
+
if (this.manager && !forceRecreate) {
|
| 158 |
+
this.logger.warn('License manager already initialized or shutting down');
|
| 159 |
+
return;
|
| 160 |
+
}
|
| 161 |
+
if (this.isShuttingDown) {
|
| 162 |
+
this.logger.warn('License manager already shutting down');
|
| 163 |
+
return;
|
| 164 |
+
}
|
| 165 |
+
const { instanceType } = this.instanceSettings;
|
| 166 |
+
const isMainInstance = instanceType === 'main';
|
| 167 |
+
const server = this.globalConfig.license.serverUrl;
|
| 168 |
+
const offlineMode = !isMainInstance;
|
| 169 |
+
const autoRenewOffset = 72 * constants_1.Time.hours.toSeconds;
|
| 170 |
+
const saveCertStr = isMainInstance
|
| 171 |
+
? async (value) => await this.saveCertStr(value)
|
| 172 |
+
: async () => { };
|
| 173 |
+
const onFeatureChange = isMainInstance
|
| 174 |
+
? async () => await this.onFeatureChange()
|
| 175 |
+
: async () => { };
|
| 176 |
+
const onLicenseRenewed = isMainInstance
|
| 177 |
+
? async () => await this.onLicenseRenewed()
|
| 178 |
+
: async () => { };
|
| 179 |
+
const collectUsageMetrics = isMainInstance
|
| 180 |
+
? async () => await this.licenseMetricsService.collectUsageMetrics()
|
| 181 |
+
: async () => [];
|
| 182 |
+
const collectPassthroughData = isMainInstance
|
| 183 |
+
? async () => await this.licenseMetricsService.collectPassthroughData()
|
| 184 |
+
: async () => ({});
|
| 185 |
+
const onExpirySoon = !this.instanceSettings.isLeader ? () => this.onExpirySoon() : undefined;
|
| 186 |
+
const expirySoonOffsetMins = !this.instanceSettings.isLeader ? 120 : undefined;
|
| 187 |
+
const { isLeader } = this.instanceSettings;
|
| 188 |
+
const { autoRenewalEnabled } = this.globalConfig.license;
|
| 189 |
+
const eligibleToRenew = isCli || isLeader;
|
| 190 |
+
const shouldRenew = eligibleToRenew && autoRenewalEnabled;
|
| 191 |
+
if (eligibleToRenew && !autoRenewalEnabled) {
|
| 192 |
+
this.logger.warn(LICENSE_RENEWAL_DISABLED_WARNING);
|
| 193 |
+
}
|
| 194 |
+
try {
|
| 195 |
+
this.manager = new license_sdk_1.LicenseManager({
|
| 196 |
+
server,
|
| 197 |
+
tenantId: this.globalConfig.license.tenantId,
|
| 198 |
+
productIdentifier: `n8n-${constants_2.N8N_VERSION}`,
|
| 199 |
+
autoRenewEnabled: shouldRenew,
|
| 200 |
+
renewOnInit: shouldRenew,
|
| 201 |
+
autoRenewOffset,
|
| 202 |
+
detachFloatingOnShutdown: this.globalConfig.license.detachFloatingOnShutdown,
|
| 203 |
+
offlineMode,
|
| 204 |
+
logger: this.logger,
|
| 205 |
+
loadCertStr: async () => await this.loadCertStr(),
|
| 206 |
+
saveCertStr,
|
| 207 |
+
deviceFingerprint: () => this.instanceSettings.instanceId,
|
| 208 |
+
collectUsageMetrics,
|
| 209 |
+
collectPassthroughData,
|
| 210 |
+
onFeatureChange,
|
| 211 |
+
onLicenseRenewed,
|
| 212 |
+
onExpirySoon,
|
| 213 |
+
expirySoonOffsetMins,
|
| 214 |
+
});
|
| 215 |
+
await this.manager.initialize();
|
| 216 |
+
this.logger.debug('License initialized');
|
| 217 |
+
}
|
| 218 |
+
catch (error) {
|
| 219 |
+
if (error instanceof Error) {
|
| 220 |
+
this.logger.error('Could not initialize license manager sdk', { error });
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
async loadCertStr() {
|
| 225 |
+
const ephemeralLicense = this.globalConfig.license.cert;
|
| 226 |
+
if (ephemeralLicense) {
|
| 227 |
+
return ephemeralLicense;
|
| 228 |
+
}
|
| 229 |
+
const databaseSettings = await this.settingsRepository.findOne({
|
| 230 |
+
where: {
|
| 231 |
+
key: constants_2.SETTINGS_LICENSE_CERT_KEY,
|
| 232 |
+
},
|
| 233 |
+
});
|
| 234 |
+
return databaseSettings?.value ?? '';
|
| 235 |
+
}
|
| 236 |
+
async onFeatureChange() {
|
| 237 |
+
void this.broadcastReloadLicenseCommand();
|
| 238 |
+
await this.notifyRefreshCallbacks();
|
| 239 |
+
}
|
| 240 |
+
async onLicenseRenewed() {
|
| 241 |
+
void this.broadcastReloadLicenseCommand();
|
| 242 |
+
await this.notifyRefreshCallbacks();
|
| 243 |
+
}
|
| 244 |
+
async broadcastReloadLicenseCommand() {
|
| 245 |
+
if (this.globalConfig.executions.mode === 'queue' && this.instanceSettings.isLeader) {
|
| 246 |
+
const { Publisher } = await Promise.resolve().then(() => __importStar(require('./scaling/pubsub/publisher.service')));
|
| 247 |
+
await di_1.Container.get(Publisher).publishCommand({ command: 'reload-license' });
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
async saveCertStr(value) {
|
| 251 |
+
if (this.globalConfig.license.cert)
|
| 252 |
+
return;
|
| 253 |
+
await this.settingsRepository.upsert({
|
| 254 |
+
key: constants_2.SETTINGS_LICENSE_CERT_KEY,
|
| 255 |
+
value,
|
| 256 |
+
loadOnStartup: false,
|
| 257 |
+
}, ['key']);
|
| 258 |
+
}
|
| 259 |
+
onCertRefresh(refreshCallback) {
|
| 260 |
+
this.refreshCallbacks.push(refreshCallback);
|
| 261 |
+
return () => {
|
| 262 |
+
const index = this.refreshCallbacks.indexOf(refreshCallback);
|
| 263 |
+
if (index > -1) {
|
| 264 |
+
this.refreshCallbacks.splice(index, 1);
|
| 265 |
+
}
|
| 266 |
+
};
|
| 267 |
+
}
|
| 268 |
+
async notifyRefreshCallbacks() {
|
| 269 |
+
const cert = await this.loadCertStr();
|
| 270 |
+
for (const refreshCallback of this.refreshCallbacks) {
|
| 271 |
+
try {
|
| 272 |
+
refreshCallback(cert);
|
| 273 |
+
}
|
| 274 |
+
catch (error) {
|
| 275 |
+
this.logger.error('Error in license refresh callback', { error });
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
}
|
| 279 |
+
async activate(activationKey, eulaUri, userEmail) {
|
| 280 |
+
if (!this.manager) {
|
| 281 |
+
return;
|
| 282 |
+
}
|
| 283 |
+
await this.manager.activate(activationKey, { eulaUri, email: userEmail });
|
| 284 |
+
this.logger.debug('License activated');
|
| 285 |
+
}
|
| 286 |
+
async reload() {
|
| 287 |
+
if (!this.manager) {
|
| 288 |
+
return;
|
| 289 |
+
}
|
| 290 |
+
await this.manager.reload();
|
| 291 |
+
await this.notifyRefreshCallbacks();
|
| 292 |
+
this.logger.debug('License reloaded');
|
| 293 |
+
}
|
| 294 |
+
async renew() {
|
| 295 |
+
if (!this.manager) {
|
| 296 |
+
return;
|
| 297 |
+
}
|
| 298 |
+
await this.manager.renew();
|
| 299 |
+
this.logger.debug('License renewed');
|
| 300 |
+
}
|
| 301 |
+
async clear() {
|
| 302 |
+
if (!this.manager) {
|
| 303 |
+
return;
|
| 304 |
+
}
|
| 305 |
+
await this.manager.clear();
|
| 306 |
+
this.logger.info('License cleared');
|
| 307 |
+
}
|
| 308 |
+
async shutdown() {
|
| 309 |
+
this.isShuttingDown = true;
|
| 310 |
+
if (!this.manager) {
|
| 311 |
+
return;
|
| 312 |
+
}
|
| 313 |
+
await this.manager.shutdown();
|
| 314 |
+
this.logger.debug('License shut down');
|
| 315 |
+
}
|
| 316 |
+
isLicensed(feature) { return true; }
|
| 317 |
+
isDynamicCredentialsEnabled() { return true; }
|
| 318 |
+
isSharingEnabled() { return true; }
|
| 319 |
+
isLogStreamingEnabled() { return true; }
|
| 320 |
+
isLdapEnabled() { return true; }
|
| 321 |
+
isSamlEnabled() { return true; }
|
| 322 |
+
isAiAssistantEnabled() { return true; }
|
| 323 |
+
isAskAiEnabled() { return true; }
|
| 324 |
+
isAiCreditsEnabled() { return true; }
|
| 325 |
+
isAdvancedExecutionFiltersEnabled() { return true; }
|
| 326 |
+
isAdvancedPermissionsLicensed() { return true; }
|
| 327 |
+
isDebugInEditorLicensed() { return true; }
|
| 328 |
+
isBinaryDataS3Licensed() { return true; }
|
| 329 |
+
isMultiMainLicensed() { return true; }
|
| 330 |
+
isVariablesEnabled() { return true; }
|
| 331 |
+
isSourceControlLicensed() { return true; }
|
| 332 |
+
isExternalSecretsEnabled() { return true; }
|
| 333 |
+
isAPIDisabled() { return false; }
|
| 334 |
+
isWorkerViewLicensed() { return true; }
|
| 335 |
+
isProjectRoleAdminLicensed() { return true; }
|
| 336 |
+
isProjectRoleEditorLicensed() { return true; }
|
| 337 |
+
isProjectRoleViewerLicensed() { return true; }
|
| 338 |
+
isCustomNpmRegistryEnabled() { return true; }
|
| 339 |
+
isFoldersEnabled() { return true; }
|
| 340 |
+
getCurrentEntitlements() { return this.manager?.getCurrentEntitlements() ?? []; }
|
| 341 |
+
getValue(feature) { return 99999999; }
|
| 342 |
+
getManagementJwt() { return this.manager?.getManagementJwt() ?? ''; }
|
| 343 |
+
getMainPlan() {
|
| 344 |
+
if (!this.manager) return undefined;
|
| 345 |
+
const entitlements = this.getCurrentEntitlements();
|
| 346 |
+
if (!entitlements.length) return undefined;
|
| 347 |
+
entitlements.sort((a, b) => b.validFrom.getTime() - a.validFrom.getTime());
|
| 348 |
+
return entitlements.find((entitlement) => entitlement.productMetadata?.terms?.isMainPlan);
|
| 349 |
+
}
|
| 350 |
+
getConsumerId() { return this.manager?.getConsumerId() ?? 'unknown'; }
|
| 351 |
+
getUsersLimit() { return 99999999; }
|
| 352 |
+
getTriggerLimit() { return 99999999; }
|
| 353 |
+
getVariablesLimit() { return 99999999; }
|
| 354 |
+
getAiCredits() { return 99999999; }
|
| 355 |
+
getWorkflowHistoryPruneLimit() { return 99999999; }
|
| 356 |
+
getTeamProjectLimit() { return 99999999; }
|
| 357 |
+
getPlanName() { return "Enterprise"; }
|
| 358 |
+
getExpiryDate() { return new Date('3099-12-31'); }
|
| 359 |
+
getTerminationDate() { return new Date('3099-12-31'); }
|
| 360 |
+
getExpiringInDays() { return 36500; }
|
| 361 |
+
getTerminatingInDays() { return 36500; }
|
| 362 |
+
getInfo() { return 'Enterprise License (Unlimited)'; }
|
| 363 |
+
isWithinUsersLimit() { return true; }
|
| 364 |
+
enableAutoRenewals() {}
|
| 365 |
+
disableAutoRenewals() {}
|
| 366 |
+
onExpirySoon() {}
|
| 367 |
+
};
|
| 368 |
+
exports.License = License;
|
| 369 |
+
__decorate([
|
| 370 |
+
(0, decorators_1.OnPubSubEvent)('reload-license'),
|
| 371 |
+
__metadata("design:type", Function),
|
| 372 |
+
__metadata("design:paramtypes", []),
|
| 373 |
+
__metadata("design:returntype", Promise)
|
| 374 |
+
], License.prototype, "reload", null);
|
| 375 |
+
__decorate([
|
| 376 |
+
(0, decorators_1.OnShutdown)(),
|
| 377 |
+
__metadata("design:type", Function),
|
| 378 |
+
__metadata("design:paramtypes", []),
|
| 379 |
+
__metadata("design:returntype", Promise)
|
| 380 |
+
], License.prototype, "shutdown", null);
|
| 381 |
+
__decorate([
|
| 382 |
+
(0, decorators_1.OnLeaderTakeover)(),
|
| 383 |
+
__metadata("design:type", Function),
|
| 384 |
+
__metadata("design:paramtypes", []),
|
| 385 |
+
__metadata("design:returntype", void 0)
|
| 386 |
+
], License.prototype, "enableAutoRenewals", null);
|
| 387 |
+
__decorate([
|
| 388 |
+
(0, decorators_1.OnLeaderStepdown)(),
|
| 389 |
+
__metadata("design:type", Function),
|
| 390 |
+
__metadata("design:paramtypes", []),
|
| 391 |
+
__metadata("design:returntype", void 0)
|
| 392 |
+
], License.prototype, "disableAutoRenewals", null);
|
| 393 |
+
exports.License = License = __decorate([
|
| 394 |
+
(0, di_1.Service)(),
|
| 395 |
+
__metadata("design:paramtypes", [backend_common_1.Logger,
|
| 396 |
+
n8n_core_1.InstanceSettings,
|
| 397 |
+
db_1.SettingsRepository,
|
| 398 |
+
license_metrics_service_1.LicenseMetricsService,
|
| 399 |
+
config_1.GlobalConfig])
|
| 400 |
+
], License);
|
| 401 |
+
EOF
|
| 402 |
|
| 403 |
+
# ==============================
|
| 404 |
+
# 启动 n8n
|
| 405 |
+
# ==============================
|
| 406 |
USER node
|
|
|
|
|
|