Skip to content

Commit

Permalink
Env contains distributable flag (elastic#40361)
Browse files Browse the repository at this point in the history
* env contains distributable flag

* make sure flag is always boolean
  • Loading branch information
mshustov authored and chrisronline committed Jul 11, 2019
1 parent d429cfc commit e082e57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/core/server/config/__snapshots__/env.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/core/server/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface PackageInfo {
branch: string;
buildNum: number;
buildSha: string;
dist: boolean;
}

export interface EnvironmentMode {
Expand Down Expand Up @@ -132,12 +133,13 @@ export class Env {
prod: !isDevMode,
});

const isKibanaDistributable = pkg.build && pkg.build.distributable === true;
const isKibanaDistributable = Boolean(pkg.build && pkg.build.distributable === true);
this.packageInfo = Object.freeze({
branch: pkg.branch,
buildNum: isKibanaDistributable ? pkg.build.number : Number.MAX_SAFE_INTEGER,
buildSha: isKibanaDistributable ? pkg.build.sha : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
version: pkg.version,
dist: isKibanaDistributable,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const packageInfo = {
buildNum: 1,
buildSha: '',
version: '7.0.0-alpha1',
dist: false,
};

afterEach(() => {
Expand Down

0 comments on commit e082e57

Please sign in to comment.