1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-09 01:17:06 +02:00

Added enterpriseVersion to root of IUnleashConfig/IUnleashOptions

This commit is contained in:
Christopher Kolstad 2021-04-23 11:05:25 +02:00
parent c58612fc8f
commit 8845c90f57
4 changed files with 11 additions and 5 deletions

View File

@ -196,6 +196,7 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig {
preHook: options.preHook, preHook: options.preHook,
preRouterHook: options.preRouterHook, preRouterHook: options.preRouterHook,
eventHook: options.eventHook, eventHook: options.eventHook,
enterpriseVersion: options.enterpriseVersion,
}; };
} }

View File

@ -65,8 +65,8 @@ test.serial('supports setting enterprise version as well', async t => {
getLogger, getLogger,
versionCheck: { url: testurl, enable: true }, versionCheck: { url: testurl, enable: true },
version, version,
enterpriseVersion,
}, },
enterpriseVersion,
); );
await service.checkLatestVersion(); await service.checkLatestVersion();
fetchMock.done(); fetchMock.done();
@ -104,8 +104,8 @@ test.serial(
getLogger, getLogger,
versionCheck: { url: testurl, enable: false }, versionCheck: { url: testurl, enable: false },
version, version,
enterpriseVersion,
}, },
enterpriseVersion,
); );
await service.checkLatestVersion(); await service.checkLatestVersion();
t.false(fetchMock.called(testurl)); t.false(fetchMock.called(testurl));

View File

@ -41,14 +41,17 @@ export default class VersionService {
{ {
getLogger, getLogger,
versionCheck, versionCheck,
}: Pick<IUnleashConfig, 'getLogger' | 'versionCheck'>, enterpriseVersion,
enterpriseVersion?: string, }: Pick<
IUnleashConfig,
'getLogger' | 'versionCheck' | 'enterpriseVersion'
>,
) { ) {
this.logger = getLogger('lib/services/version-service.js'); this.logger = getLogger('lib/services/version-service.js');
this.settingStore = settingStore; this.settingStore = settingStore;
this.current = { this.current = {
oss: version, oss: version,
enterprise: enterpriseVersion, enterprise: enterpriseVersion || '',
}; };
this.enabled = versionCheck.enable; this.enabled = versionCheck.enable;
this.versionCheckUrl = versionCheck.url; this.versionCheckUrl = versionCheck.url;

View File

@ -87,6 +87,7 @@ export interface IUnleashOptions {
preHook?: Function; preHook?: Function;
preRouterHook?: Function; preRouterHook?: Function;
eventHook?: Function; eventHook?: Function;
enterpriseVersion?: string;
} }
export interface IEmailOption { export interface IEmailOption {
@ -125,4 +126,5 @@ export interface IUnleashConfig {
preHook?: Function; preHook?: Function;
preRouterHook?: Function; preRouterHook?: Function;
eventHook?: Function; eventHook?: Function;
enterpriseVersion?: string;
} }