Skip to content

Commit

Permalink
Use branch & version from package.json as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Jul 30, 2020
1 parent d49f968 commit 421f3ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/ingest_manager/server/services/app_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EncryptedSavedObjectsClient,
EncryptedSavedObjectsPluginSetup,
} from '../../../encrypted_saved_objects/server';
import packageJSON from '../../../../../package.json';
import { SecurityPluginSetup } from '../../../security/server';
import { IngestManagerConfigType } from '../../common';
import { ExternalCallback, ExternalCallbacksStorage, IngestManagerAppContext } from '../plugin';
Expand All @@ -23,8 +24,8 @@ class AppContextService {
private configSubject$?: BehaviorSubject<IngestManagerConfigType>;
private savedObjects: SavedObjectsServiceStart | undefined;
private isProductionMode: IngestManagerAppContext['isProductionMode'] = false;
private kibanaVersion: IngestManagerAppContext['kibanaVersion'] | undefined;
private kibanaBranch: IngestManagerAppContext['kibanaBranch'] | undefined;
private kibanaVersion: IngestManagerAppContext['kibanaVersion'] | undefined = packageJSON.version;
private kibanaBranch: IngestManagerAppContext['kibanaBranch'] | undefined = packageJSON.branch;
private cloud?: CloudSetup;
private logger: Logger | undefined;
private httpSetup?: HttpServiceSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ const SNAPSHOT_REGISTRY_URL_CDN = 'https://epr-snapshot.elastic.co';
// const SNAPSHOT_REGISTRY_URL_NO_CDN = 'https://epr-snapshot.ea-web.elastic.dev';

const getDefaultRegistryUrl = (): string => {
let branch;
try {
branch = appContextService.getKibanaBranch();
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}

const branch = appContextService.getKibanaBranch();
if (branch === 'master') {
return SNAPSHOT_REGISTRY_URL_CDN;
} else {
Expand Down

0 comments on commit 421f3ac

Please sign in to comment.