{"id":26096152,"url":"https://github.com/alt-javascript/config","last_synced_at":"2026-03-10T07:12:27.492Z","repository":{"id":48648146,"uuid":"385031480","full_name":"alt-javascript/config","owner":"alt-javascript","description":"An extensible wrapper of the popular config package, supporting placeholder resolution (or variable expansion); encrypted values (via jasypt); default (or fallback) values; and asynchronous url fetching.","archived":false,"fork":false,"pushed_at":"2022-04-19T23:39:07.000Z","size":861,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T22:29:26.759Z","etag":null,"topics":["config","enrypted","fetch","javascript","nodejs","placeholders","properties","url","variable-expansion"],"latest_commit_sha":null,"homepage":"","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/alt-javascript.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2021-07-11T19:04:22.000Z","updated_at":"2021-10-08T04:23:24.000Z","dependencies_parsed_at":"2022-09-10T23:30:48.760Z","dependency_job_id":null,"html_url":"https://github.com/alt-javascript/config","commit_stats":null,"previous_names":["craigparra/alt-config"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/alt-javascript/config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alt-javascript","download_url":"https://codeload.github.com/alt-javascript/config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["config","enrypted","fetch","javascript","nodejs","placeholders","properties","url","variable-expansion"],"created_at":"2025-03-09T14:35:29.608Z","updated_at":"2026-03-10T07:12:27.481Z","avatar_url":"https://github.com/alt-javascript.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"An Extensible Wrapper for Node Config\n=====================================\n\n[![NPM](https://nodei.co/npm/@alt-javascript/config.svg?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/@alt-javascript/config/)\n\u003cbr/\u003e\n![Language Badge](https://img.shields.io/github/languages/top/@alt-javascript/config)\n![Package Badge](https://img.shields.io/npm/v/@alt-javascript/config) \u003cbr/\u003e\n[release notes](https://github.com/@alt-javascript/config/blob/main/History.md)\n\n\u003ca name=\"intro\"\u003eIntroduction\u003c/a\u003e\n--------------------------------\nAn extensible wrapper of the popular config package, supporting:\n- placeholder resolution (or variable expansion),\n- encrypted values (via jasypt) \n- default (or fallback) values, \n- and optional asynchronous url fetching.\n\n\u003ca name=\"usage\"\u003eUsage\u003c/a\u003e\n-------------------------\n\nTo use the module, substitute the named {config} module export, in place of the popular \n[config](https://www.npmjs.com/package/config) default \u0026ndash; note, we use named exports, because the module\nexports other useful classes as well.\n\n```javascript\nimport  { config } from '@alt-javascript/config' ;\n\nconfig.get('key');\nconfig.get('nested.key');\nconfig.get('unknown','use this instead'); // this does not throw an error\n```\n\nConfig values that include the common `${placeholder}` syntax, will resolve the inline \nplaceholders, so the `config.get('placeholder')'` path below will return `start.one.two.end`.\n\nConfig values that start with the prefix `enc.` will be decrypted with the \n[jasypt](https://www.npmjs.com/package/jasypt) package port, with the passphrase being\nsourced from the `process.env.NODE_CONFIG_PASSPHRASE` environment variable.\n\nOptionally, config values that start with the prefix `url.` can be fetched and resolved asynchronously with the `fetch` \nfunction, and HTTP options can be specified as in the example config file.  To avoid bundling `node-fetch`, you need to\nprovide it by using `@alt-javascript/boot` to boot it into the global root context, where the package will detect it.\n\n```javascript\nimport { boot } from '@alt-javascript/boot';\nimport { config } from '@alt-javascript/config';\nimport fetch from 'node-fetch';\n\nboot({config,fetch})\nconst webdata = await config.fetch('pathToUrlPrefixedValue'); \n```\n\u003e :warning: While we have implemented asynchronous fetch from \"the network\", we discourage it.  \n\u003e \n\u003e It's mostly a design flex.\n\u003e \n\u003e Configuration should be static and immutable contextual information your system needs on application bootstrap, and \n\u003e configuration as a service increases the complexity of your deployment architecture, making it difficult to configure\n\u003e different, and ephemeral deployment options, including local development and testing.\n\u003e \n\u003e Don't say we didn't warn you.\n\n\n`local-development.json`\n```json\n{\n  \"key\": \"value\",\n  \"one\" : \"one\",\n  \"placeholder\": \"start.${one}.${nested.two}.end\",\n  \"placeholderEncrypted\": \"start.${nested.encrypted}.end\",\n  \"nested\" : {\n    \"key\" : \"value\",\n    \"two\" : \"two\",\n    \"placeholder\": \"start.${one}.${nested.two}.end\",\n    \"encrypted\" : \"enc.pxQ6z9s/LRpGB+4ddJ8bsq8RqELmhVU2\",\n    \"encryptedWithSecret\" : \"ENC(./emLGkD3cbfqoSPijGZ0jh1p1SYIHQeJ)\"\n  },\n  \"jsonplaceholder\": {\n    \"todos\": \"url.https://jsonplaceholder.typicode.com/todos/1\"\n  },\n  \"fetchWithOpts\" : {\n    \"url\": \"url.https://jsonplaceholder.typicode.com/todos/1\",\n    \"urlAlt\": \"URL(https://jsonplaceholder.typicode.com/todos/1)\",\n    \"urlFetch\": \"fetch(https://jsonplaceholder.typicode.com/todos/1)\",\n    \"authorization\": \"Basic dXNlcjpwYXNz\",\n    \"method\": \"get\",\n    \"body\": {},\n    \"headers\": {\"Content-Type\": \"application/json\"}\n  }\n}\n```\n### Browser\n\nThe module is also able to be used directly in the browser, in combination with the config module.\nYou can either import the LoggerFactory globally as an IIFE (Immediately Invoked Function Expression),\nas follows:\n\n```html\n   \u003cscript src=\"https://cdn.jsdelivr.net/npm/@alt-javascript/config/dist/alt-javascript-configfactory-iife.js\"\u003e\u003c/script\u003e\n   \u003cscript\u003e\n       var config = ConfigFactory.getConfig({\n           logging : {\n               format : 'json',\n               level : {\n                   '/' : 'info',\n                   '/MyPage': 'info'\n               }\n           }\n           \"http://127+0+0+1:8080\" : {\n               logging : {\n                   format : 'json',\n                   level : {\n                       '/' : 'info',\n                       '/MyPage' : 'debug'\n                   }\n               }             \n           }\n\n       })\n       var logger = LoggerFactory.getLogger('/MyPage',config);\n       logger.debug('Hello World');\n   \u003c/script\u003e\n```\n\nOr import the ES6 module bundle from a module, as follows:\n\n```javascript\nimport { ConfigFactory } from 'https://cdn.jsdelivr.net/npm/@alt-javascript/logger/dist/alt-javascript-config-esm.js'\n\n//...as above\n```\n\nEncrypted config is not supported in the browser (by default), as it is \ninherently unsecure (there is no safe way to hide the salt).\n\nAdditionally, config sections can be prefixed with the window location to allow\nsite or environment specific configuration in the browser (periods must be replaced with\na plus sign - so mysite.com =\u003e mysite+com).\n\n\n\u003ca name=\"testing\"\u003eTestability\u003c/a\u003e\n-------------------------\n\nTesting config is hard, and testability is a first class concern at @alt-javascript so the config wrapper, \nand the module exports an EphemeralConfig that can source config paths from a plain old javascript\nobject as follows, allowing you to assert varying configurations easily\n\n```javascript\nimport {\n    EphemeralConfig, ValueResolvingConfig, PlaceHolderResolver, PlaceHolderSelector\n    \n} from '@alt-javascript/config';\n\nconst ephemeralConfig = new EphemeralConfig({\n    key: 'value',\n    nested: {\n        key: 'value',\n    },\n});\n\nconst placeHolderResolver = new PlaceHolderResolver(new PlaceHolderSelector());\nconst config = new ValueResolvingConfig(ephemeralConfig,placeHolderResolver );\n```\n\n\u003ca name=\"license\"\u003eLicense\u003c/a\u003e\n-----------------------------\n\nMay be freely distributed under the [MIT license](https://raw.githubusercontent.com/alt-javascript/config/main/LICENSE).\n\nCopyright (c) 2021 Craig Parravicini    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-javascript%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falt-javascript%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-javascript%2Fconfig/lists"}