Skip to content

Commit b1e18f7

Browse files
authored
Merge pull request #76834 from bnb/patch-1
Improve code example in Environment Variables section of functions-reference-node.md
2 parents 6871af2 + 400193b commit b1e18f7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

articles/azure-functions/functions-reference-node.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,23 +461,16 @@ There are two ways to install packages on your Function App:
461461

462462
## Environment variables
463463

464-
In Functions, [app settings](functions-app-settings.md), such as service connection strings, are exposed as environment variables during execution. You can access these settings using `process.env`, as shown here in the `GetEnvironmentVariable` function:
464+
In Functions, [app settings](functions-app-settings.md), such as service connection strings, are exposed as environment variables during execution. You can access these settings using `process.env`, as shown here in the second and third calls to `context.log()` where we log the `AzureWebJobsStorage` and `WEBSITE_SITE_NAME` environment variables:
465465

466466
```javascript
467-
module.exports = function (context, myTimer) {
467+
module.exports = async function (context, myTimer) {
468468
var timeStamp = new Date().toISOString();
469469

470470
context.log('Node.js timer trigger function ran!', timeStamp);
471-
context.log(GetEnvironmentVariable("AzureWebJobsStorage"));
472-
context.log(GetEnvironmentVariable("WEBSITE_SITE_NAME"));
473-
474-
context.done();
471+
context.log("AzureWebJobsStorage: " + process.env["AzureWebJobsStorage"]);
472+
context.log("WEBSITE_SITE_NAME: " + process.env["WEBSITE_SITE_NAME"]);
475473
};
476-
477-
function GetEnvironmentVariable(name)
478-
{
479-
return name + ": " + process.env[name];
480-
}
481474
```
482475
483476
[!INCLUDE [Function app settings](../../includes/functions-app-settings.md)]

0 commit comments

Comments
 (0)