Skip to content

Commit

Permalink
chore: updates heroku env variable to not rely on dyno metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
CyntiBinti committed Nov 7, 2023
1 parent b33028c commit fe22b5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/app-info/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ module.exports = {
cloudProvider:
(processType === process.env.AWS_LAMBDA_FUNCTION_NAME
? 'aws'
: processType === process.env.DYNO
? 'heroku'
: null) || null
: Boolean(process.env.HEROKU_RELEASE_CREATED_AT)
? 'heroku'
: null) || null
};

// @ts-ignore
Expand Down
8 changes: 4 additions & 4 deletions packages/app-info/test/unit/lib/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,16 @@ describe('@dotcom-reliability-kit/app-info', () => {
}
});

it('is set to `heroku` if processType is set to `process.env.DYNO`', () => {
if (appInfo.processType === process.env.DYNO) {
it('is set to `heroku` if `process.env.HEROKU_RELEASE_CREATED_AT` is set to true', () => {
if (process.env.HEROKU_RELEASE_CREATED_AT) {
expect(appInfo.cloudProvider).toBe('heroku');
}
});

describe('when neither `process.env.AWS_LAMBDA_FUNCTION_NAME` or `process.env.DYNO` are defined', () => {
describe('when neither `process.env.AWS_LAMBDA_FUNCTION_NAME` or `process.env.HEROKU_RELEASE_CREATED_AT` are defined', () => {
beforeEach(() => {
jest.resetModules();
delete process.env.DYNO;
delete process.env.HEROKU_RELEASE_CREATED_AT;
delete process.env.AWS_LAMBDA_FUNCTION_NAME;
appInfo = require('../../../lib');
});
Expand Down

0 comments on commit fe22b5a

Please sign in to comment.