Skip to content

Commit

Permalink
Move licenseService to FleetStartDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
criamico committed Feb 17, 2022
1 parent 47f6ac4 commit bf7e333
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/fleet/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export interface FleetStart {
}

export interface FleetSetupDeps {
licensing: LicensingPluginStart;
data: DataPublicPluginSetup;
home?: HomePublicPluginSetup;
cloud?: CloudSetup;
Expand All @@ -93,6 +92,7 @@ export interface FleetSetupDeps {
}

export interface FleetStartDeps {
licensing: LicensingPluginStart;
data: DataPublicPluginStart;
fieldFormats: FieldFormatsStart;
navigation: NavigationPublicPluginStart;
Expand Down Expand Up @@ -131,9 +131,6 @@ export class FleetPlugin implements Plugin<FleetSetup, FleetStart, FleetSetupDep
// Set up http client
setHttpClient(core.http);

// Set up license service
licenseService.start(deps.licensing.license$);

// Register Integrations app
core.application.register({
id: INTEGRATIONS_PLUGIN_ID,
Expand Down Expand Up @@ -258,6 +255,9 @@ export class FleetPlugin implements Plugin<FleetSetup, FleetStart, FleetSetupDep
core.http.get<CheckPermissionsResponse>(appRoutesService.getCheckPermissionsPath())
);

// Set up license service
licenseService.start(deps.licensing.license$);

registerExtension({
package: CUSTOM_LOGS_INTEGRATION_NAME,
view: 'package-detail-assets',
Expand Down
9 changes: 3 additions & 6 deletions x-pack/plugins/fleet/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
ServiceStatusLevels,
} from '../../../../src/core/server';
import type { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server';
import type { LicensingPluginStart, ILicense } from '../../licensing/server';
import type { LicensingPluginStart } from '../../licensing/server';
import type {
EncryptedSavedObjectsPluginStart,
EncryptedSavedObjectsPluginSetup,
Expand Down Expand Up @@ -93,7 +93,6 @@ import { TelemetryEventsSender } from './telemetry/sender';
import { setupFleet } from './services/setup';

export interface FleetSetupDeps {
licensing: LicensingPluginStart;
security: SecurityPluginSetup;
features?: FeaturesPluginSetup;
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
Expand All @@ -105,6 +104,7 @@ export interface FleetSetupDeps {

export interface FleetStartDeps {
data: DataPluginStart;
licensing: LicensingPluginStart;
encryptedSavedObjects: EncryptedSavedObjectsPluginStart;
security: SecurityPluginStart;
telemetry?: TelemetryPluginStart;
Expand Down Expand Up @@ -177,7 +177,6 @@ export interface FleetStartContract {
export class FleetPlugin
implements Plugin<FleetSetupContract, FleetStartContract, FleetSetupDeps, FleetStartDeps>
{
private licensing$!: Observable<ILicense>;
private config$: Observable<FleetConfigType>;
private configInitialValue: FleetConfigType;
private cloud?: CloudSetup;
Expand Down Expand Up @@ -212,7 +211,6 @@ export class FleetPlugin

public setup(core: CoreSetup, deps: FleetSetupDeps) {
this.httpSetup = core.http;
this.licensing$ = deps.licensing.license$;
this.encryptedSavedObjectsSetup = deps.encryptedSavedObjects;
this.cloud = deps.cloud;
this.securitySetup = deps.security;
Expand Down Expand Up @@ -384,7 +382,6 @@ export class FleetPlugin

this.telemetryEventsSender.setup(deps.telemetry);
}

public start(core: CoreStart, plugins: FleetStartDeps): FleetStartContract {
appContextService.start({
elasticsearch: core.elasticsearch,
Expand All @@ -404,7 +401,7 @@ export class FleetPlugin
logger: this.logger,
telemetryEventsSender: this.telemetryEventsSender,
});
licenseService.start(this.licensing$);
licenseService.start(plugins.licensing.license$);

this.telemetryEventsSender.start(plugins.telemetry, core);

Expand Down

0 comments on commit bf7e333

Please sign in to comment.