-
Notifications
You must be signed in to change notification settings - Fork 66
chore: use new GCF env vars in descriptor #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use new GCF env vars in descriptor #436
Conversation
The `K_SERVICE` and `GOOGLE_CLOUD_REGION` env vars are the preferred way of getting function name and region information going forward.
Codecov Report
@@ Coverage Diff @@
## master #436 +/- ##
==========================================
+ Coverage 90.6% 90.63% +0.02%
==========================================
Files 14 14
Lines 628 630 +2
Branches 32 34 +2
==========================================
+ Hits 569 571 +2
Misses 41 41
Partials 18 18
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #436 +/- ##
==========================================
+ Coverage 90.6% 90.63% +0.02%
==========================================
Files 14 14
Lines 628 630 +2
Branches 32 34 +2
==========================================
+ Hits 569 571 +2
Misses 41 41
Partials 18 18
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth documenting this somewhere in the code? I'm wondering if anyone will get tripped up expecting the old env var to take precedence.
test/metadata.ts
Outdated
beforeEach(() => { | ||
process.env.FUNCTION_NAME = FUNCTION_NAME; | ||
process.env.FUNCTION_REGION = FUNCTION_REGION; | ||
delete process.env.K_SERVICE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use something like sinon to stub instead? Worried that running the tests will stomp my current session's environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sinon looked more complicated than needed, but I've updated the code to use before/after hooks to restore the parts of process.env
I am modifying.
@callmehiphop I've added code docs. |
The
K_SERVICE
andGOOGLE_CLOUD_REGION
env vars are thepreferred way of getting function name and region information
going forward.