Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradoyler/localsettings
local.settings.json loader for Azure Functions
https://github.com/bradoyler/localsettings
azure-functions javascript nodejs
Last synced: 17 days ago
JSON representation
local.settings.json loader for Azure Functions
- Host: GitHub
- URL: https://github.com/bradoyler/localsettings
- Owner: bradoyler
- Created: 2020-02-08T21:03:05.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-13T00:50:51.000Z (over 2 years ago)
- Last Synced: 2024-10-11T01:14:24.764Z (about 1 month ago)
- Topics: azure-functions, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 118 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# local.settings
A zero-dependency `process.env` loader for Microsoft Azure's `local.settings.json` file
## Install
```sh
# with npm
npm install localsettings# or with Yarn
yarn add localsettings
```## Usage
As early as possible in your application, require and configure localsettings```sh
require('localsettings').config()
````process.env` now has the keys and values you defined in your `local.settings.json` file.
### Preload
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload localsettings. By doing this, you do not need to require and load localsettings in your application code. This is the preferred approach when using `import` instead of `require`.
```bash
$ node -r localsettings/config your_script.js
```