{"id":21817934,"url":"https://github.com/iansu/config4","last_synced_at":"2025-08-07T15:19:35.331Z","repository":{"id":70309457,"uuid":"155458393","full_name":"iansu/config4","owner":"iansu","description":"Similar to config3 but  with some changes for Lottery.com","archived":false,"fork":false,"pushed_at":"2018-09-17T16:38:05.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T10:23:49.181Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iansu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T21:26:26.000Z","updated_at":"2021-09-08T03:46:16.000Z","dependencies_parsed_at":"2023-02-25T03:00:23.336Z","dependency_job_id":null,"html_url":"https://github.com/iansu/config4","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/iansu/config4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fconfig4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fconfig4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fconfig4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fconfig4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iansu","download_url":"https://codeload.github.com/iansu/config4/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fconfig4/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267488124,"owners_count":24095779,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-27T15:49:09.659Z","updated_at":"2025-07-28T08:44:57.623Z","avatar_url":"https://github.com/iansu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Config4\n\nThis is a configuration library based on config3 but adapted to the pattern most commonly used on projects at Lottery.com. \n\n**Significant Changes**\n\n- Loads from 4 places:  config.default.js, config.environent.js, config.local.js and environment\n- Automatically parses booleans in environment vars that look like booleans `VARNAME=true`\n- Automatically parses numbers in environment vars that look like numbers eg. `VARNAME=2`\n- Parses double underscore `__` in environment vars as nested objects\n\n## How To Use\n\nAdd to your package.json\n\n` \"config4\": \"git+https://github.com/autolotto/config4.git#0.1.0\", `\n\nImport \n\n` const config = require('config4'); `\n\nUse \n\n` const myVar = config.SOME_CONSTANT; `\n\n## What To Commit\n\nBecause you can have environment specific configuration files AND set environment variables, a good convention is:\n\n1.  Put common configuration in `config.default.js`\n2.  Put non-secret environment configuration in `config.production.js`\n3.  Put secret environment configuration (like credentials) in environment variable on Heroku\n\nThis way, we:\n\n- Are not committing any credentials or passwords to git\n- Have a manageable number of environment variables\n- Can easily add settings like feature flags to files when we write code\n\n## Environment Vars Nested Objects\n\nEnvironment variables like this: \n\n ```\n MONKEY__SEE__DO=banana\n``` \n\nbecome\n\n``` \n MONKEY: {\n   SEE: {\n     DO: \"banana\" \n   }\n }\n    \n```\n\n\n## Load Order\n\nLoads configuration in the following order:\n\n`config.default.js` -  Loaded first and sets up any universal defaults.\n\n`config.{environment}.js` -  Loaded second and does environment specific configs.\n\n`config.local.js` - Override or add to anything that you set in default file.\n\n`environment vars` - Environment vars override everything.\n\n## Attribution for Past Work\n\n- Inspired by config3 which was used at lottery.com in the past\n- Based on some code from configery, a deprecated lottery.com library\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansu%2Fconfig4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiansu%2Fconfig4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansu%2Fconfig4/lists"}