feat(core): Read ephemeral license from environment and clean up ee flags (#5808)

Co-authored-by: Cornelius Suermann <cornelius@n8n.io>
This commit is contained in:
Michael Auerswald
2023-03-31 13:51:38 +02:00
committed by GitHub
parent 3ae69337ee
commit 83aef17120
19 changed files with 75 additions and 92 deletions

View File

@@ -1,6 +1,7 @@
import express from 'express';
import type { Entry as LdapUser } from 'ldapts';
import { Not } from 'typeorm';
import Container from 'typedi';
import { jsonParse } from 'n8n-workflow';
import config from '@/config';
import * as Db from '@/Db';
@@ -12,11 +13,12 @@ import { LdapService } from '@/Ldap/LdapService.ee';
import { encryptPassword, saveLdapSynchronization } from '@/Ldap/helpers';
import type { LdapConfig } from '@/Ldap/types';
import { sanitizeUser } from '@/UserManagement/UserManagementHelper';
import { getCurrentAuthenticationMethod, setCurrentAuthenticationMethod } from '@/sso/ssoHelpers';
import { License } from '@/License';
import { randomEmail, randomName, uniqueId } from './../shared/random';
import * as testDb from './../shared/testDb';
import type { AuthAgent } from '../shared/types';
import * as utils from '../shared/utils';
import { getCurrentAuthenticationMethod, setCurrentAuthenticationMethod } from '@/sso/ssoHelpers';
jest.mock('@/telemetry');
jest.mock('@/UserManagement/email/NodeMailer');
@@ -41,6 +43,7 @@ const defaultLdapConfig = {
};
beforeAll(async () => {
Container.get(License).isLdapEnabled = () => true;
app = await utils.initTestServer({ endpointGroups: ['auth', 'ldap'] });
const [globalOwnerRole, fetchedGlobalMemberRole] = await testDb.getAllRoles();
@@ -77,10 +80,10 @@ beforeEach(async () => {
config.set('userManagement.disabled', false);
config.set('userManagement.isInstanceOwnerSetUp', true);
config.set('userManagement.emails.mode', '');
config.set('enterprise.features.ldap', true);
});
afterAll(async () => {
Container.reset();
await testDb.terminate();
});