{"id":23819891,"url":"https://github.com/kth/reqvars","last_synced_at":"2026-06-05T16:32:01.113Z","repository":{"id":42989768,"uuid":"204692581","full_name":"KTH/reqvars","owner":"KTH","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-16T09:58:50.000Z","size":1234,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-01-02T07:16:09.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KTH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-27T11:53:42.000Z","updated_at":"2021-11-16T07:50:14.000Z","dependencies_parsed_at":"2023-02-10T02:05:16.467Z","dependency_job_id":null,"html_url":"https://github.com/KTH/reqvars","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Freqvars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Freqvars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Freqvars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Freqvars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/reqvars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100517,"owners_count":19747683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T07:16:15.324Z","updated_at":"2026-05-08T13:30:18.831Z","avatar_url":"https://github.com/KTH.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/KTH/reqvars.svg?branch=master)](https://travis-ci.org/KTH/reqvars)\n\n# reqvars\n\nCheck that [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env) contains all the **req**uired **var**iable**s**!\n\n## Install\n\n```sh\nnpm i @kth/reqvars\n```\n\n## Usage\n\n1. Write a `.env.in` saying which environmental variables are required in your program. This will be your **specification file**.\n\n\n    For example:\n\n    ```ini\n    DB_HOST=localhost\n    DB_USER=root\n    DB_PASS=\n    ```\n\n    If you commit the file (which is recommended) remember to leave the secrets (passwords, etc.) blank\n\n2. As early as possible in your application, require `reqvars` and call `check`:\n\n    ```js\n    require('@kth/reqvars').check()\n    ```\n\n    It will compare the `process.env` object against your **specification file** and throw an error if something is missing. By default it will look at the `.env` file in the root of your project.\n\n3. If you want to use another file as specification file, pass the path as argument:\n\n    ```js\n    require('@kth/reqvars').check('./requirements.conf')\n    ```\n\n## Tips\n\n### Usage with `dotenv`\n\nIf you use [`dotenv`](https://github.com/motdotla/dotenv), use it *before* `reqvars`:\n\n```js\nrequire('dotenv').config()\nrequire('@kth/reqvars').check()\n```\n\n### Format for `.env.in`\n\nThe `.env.in` should be human readable. Document all fields as best as possible. For example:\n\n```ini\n# Credentials for the internal database. It should be a MySQL database.\nDB_HOST=localhost\nDB_USER=root\nDB_PASS=\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Freqvars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Freqvars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Freqvars/lists"}