Home > Blockchain >  how to read local.settings.json configuration in index.js file
how to read local.settings.json configuration in index.js file

Time:02-16

I have NodeJS azure function and have some variable sets in local.settings.json file,

"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "sa",
"NEO4J_PASSWORD": "Password1",

I want to read these variables in index.js file to replace below hard coding, how to read it?

const driver = neo4j.driver(
"bolt://localhost:7687",
 neo4j.auth.basic("sa", "Password1")
);

CodePudding user response:

In index.js, You need to call the process.env method to access the application settings defined from local.settings.json as environment variables as you can see the below workaround:

workaround

Reference: Access local.settings.json application settings from Azure Functions - JavaScript

  • Related