Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
feat: GAE_DEPLOYMENT_ID used for minor version (#400)
Browse files Browse the repository at this point in the history
The `GAE_DEPLOYMENT_ID` environment variable (with a fallback to
`GAE_MINOR_VERSION`) will be used as the default value of
`minorVersion_`.

Note that the `GAE_DEPLOYMENT_ID` environment
variable is now set on AppEngine Flex.
  • Loading branch information
DominicKramer committed Feb 22, 2018
1 parent e19e514 commit f6985f7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 108 deletions.
135 changes: 72 additions & 63 deletions package-lock.json

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

18 changes: 7 additions & 11 deletions src/agent/debuglet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,8 @@ export class Debuglet extends EventEmitter {
serviceContext: {
service: process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME,
version: process.env.GAE_VERSION || process.env.GAE_MODULE_VERSION,
// Debug UI expects GAE_MINOR_VERSION to be available for AppEngine, but
// AppEngine Flex doesn't have this environment variable. We provide a
// fake value as a work-around, but only on Flex (GAE_SERVICE will be
// defined on Flex).
minorVersion_: process.env.GAE_MINOR_VERSION ||
(process.env.GAE_SERVICE ? 'fake-minor-version' : undefined)
minorVersion_:
process.env.GAE_DEPLOYMENT_ID || process.env.GAE_MINOR_VERSION
}
};

Expand Down Expand Up @@ -303,9 +299,9 @@ export class Debuglet extends EventEmitter {
if (!that.config.allowRootAsWorkingDirectory &&
path.join(workingDir, '..') === workingDir) {
const message = 'The working directory is a root directory. Disabling ' +
'to avoid a scan of the entire filesystem for JavaScript files. ' +
'Use config \allowRootAsWorkingDirectory` if you really want to ' +
'do this.';
'to avoid a scan of the entire filesystem for JavaScript files. ' +
'Use config \allowRootAsWorkingDirectory` if you really want to ' +
'do this.';
that.logger.error(message);
that.emit('initError', new Error(message));
return;
Expand Down Expand Up @@ -516,11 +512,11 @@ export class Debuglet extends EventEmitter {
return metadata.isAvailable();
}

static async getProjectIdFromMetadata() : Promise<string> {
static async getProjectIdFromMetadata(): Promise<string> {
return (await metadata.project('project-id')).data as string;
}

static async getClusterNameFromMetadata() : Promise<string> {
static async getClusterNameFromMetadata(): Promise<string> {
return (await metadata.instance('attributes/cluster-name')).data as string;
}

Expand Down

0 comments on commit f6985f7

Please sign in to comment.