import { Injectable } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { EnvironmentService } from './environment.service'; @Injectable() export class LicenseCheckService { constructor( private moduleRef: ModuleRef, private environmentService: EnvironmentService, ) {} isValidEELicense(licenseKey: string): boolean { if (this.environmentService.isCloud()) { return true; } try { // eslint-disable-next-line @typescript-eslint/no-require-imports const LicenseModule = require('../../ee/licence/license.service'); const licenseService = this.moduleRef.get(LicenseModule.LicenseService, { strict: false, }); return licenseService.isValidEELicense(licenseKey); } catch { return false; } } }