{"id":29776865,"url":"https://github.com/godaddy/slay-config","last_synced_at":"2025-07-27T10:20:55.479Z","repository":{"id":46692808,"uuid":"75152608","full_name":"godaddy/slay-config","owner":"godaddy","description":"Standard, sane defaults for config in slay apps.","archived":false,"fork":false,"pushed_at":"2022-12-29T02:25:11.000Z","size":797,"stargazers_count":1,"open_issues_count":13,"forks_count":2,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-07-18T09:59:28.139Z","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/godaddy.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":"2016-11-30T04:52:43.000Z","updated_at":"2022-11-03T03:21:04.000Z","dependencies_parsed_at":"2023-01-31T07:45:27.022Z","dependency_job_id":null,"html_url":"https://github.com/godaddy/slay-config","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/godaddy/slay-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godaddy%2Fslay-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godaddy%2Fslay-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godaddy%2Fslay-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godaddy%2Fslay-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/godaddy","download_url":"https://codeload.github.com/godaddy/slay-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godaddy%2Fslay-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267342874,"owners_count":24071991,"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-27T02:00:11.917Z","response_time":82,"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":"2025-07-27T10:20:46.467Z","updated_at":"2025-07-27T10:20:55.469Z","avatar_url":"https://github.com/godaddy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slay-config\nStandard, sane defaults for config in slay apps.\n\n## Usage\n\nSimply add `slay-config` as a preboot in your standard preboot location. Generally speaking it should be towards the top of your application's preboots since it will be loading in configuration that others will need.\n\n**lib/preboot.js**\n``` js\nmodule.exports = function (app, options, done) {\n  // ...\n\n  app.preboot(require('slay-config')({\n    //\n    // Any defaults for configuring the `nconf` instance\n    // attached to the `app`.\n    //\n  }));\n\n  // ...\n};\n```\n\nThis will setup your application config to load from (in-order):\n\n1. Any forced programmatic overrides\n2. CLI arguments\n3. Environment variables\n4. Config file (defaulting to `config/{env}.json`)\n5. _[Optional]_ [Secure file][secure-file]\n\n\n## Options\n\n``` js\napp.preboot(require('slay-config')(defaults));\n```\n\nWhere `defaults` can have the following properties (all of which are optional):\n\n* **overrides:** _{Object}_ Any [overrides] for your application's config.\n* **argv:** _{Object}_ Settings for loading [CLI arguments] into application config.\n* **env:** _{Object}_ Settings for loading [environment variables] into application config.\n* **file:** _{Object}_ Settings for loading [a file] to configure your application. Defaults to `${app.root}/config/${env}.json`.\n* **secure:** _{String}_ If set, will look for [secure nconf settings][secure-file] in the config property at that location.\n\n### Default CLI args and ENV vars\n\nIf you do not have the luxury of being able to pass in explicit options to\nconfigure a `slay-config`, we have added the ability to configure\n`slay-config` with ENV vars or CLI args.\n\n**CLI Args**:\n  - `config`: The file path for the configuration file to load.\n  - `secure-file`: The file path for the secure configuration file to load.\n  - `secure-secret`: The file path for the secret used to encrypt the secure\n    configuration file.\n\n**ENV vars**:\n  - `CONFIG`\n  - `SECURE_FILE`\n  - `SECURE_SECRET`\n\n### Loading encrypted secure config\n\nThis can be done in one of two ways:\n\n##### 1. Specifying the `secure` option in your cleartext config file\n\nWhen specifying this option be aware that _all relative file paths will resolved from `app.root`._\n\n**config/development.json**\n``` js\n{\n  // ... other configuration values\n  \"secure\": {\n    \"file\": \"./config/secure/development.json\",\n    \"secretPath\": \"./config/secure/development.key\"\n  }\n}\n```\n\n##### 2. Specifying the `secure` option when requiring `slay-config`\n\n``` js\n  app.preboot(require('slay-config')({\n    secure: {\n      file: './config/secure/development.json'\n      secretPath: './config/secure/development.key'\n    }\n  }));\n\n```\n\n### Changing configuration loading\n\nOften (and mainly for testing purposes) it is often useful to change the options passed into to your configuration loader so as to turn on or off certain values (e.g. turning off logging in your tests).\n\nWith this in mind any `defaults` passed to `slay-config` can be overridden by the `config` property passed to `app.start` e.g.:\n\n**lib/preboot.js**\n``` js\nmodule.exports = function (app, options, done) {\n  // ...\n\n  app.preboot(require('slay-config')({\n    file: { file: path.join(app.root, 'config', app.env + '.json') }\n  }));\n\n  // ...\n};\n```\n\nCan be overridden to a test configuration file when calling `app.start`:\n\n``` js\napp.start({\n  config: {\n    file: { file: path.join(app.root, 'test', 'config', app.env + '.json') }\n  }\n}, callback);\n```\n\n## Tests\n\n```\nnpm test\n```\n\n## License\nMIT\n\n##### Contributors: [Fady Matar](https://github.com/fmatar), [Charlie Robbins](https://github.com/indexzero)\n\n[overrides]: https://github.com/indexzero/nconf#literal\n[CLI arguments]: https://github.com/indexzero/nconf#argv\n[environment variables]: https://github.com/indexzero/nconf#env\n[a file]: https://github.com/indexzero/nconf#file\n[secure-file]: https://github.com/indexzero/nconf#encrypting-file-contents\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodaddy%2Fslay-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgodaddy%2Fslay-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodaddy%2Fslay-config/lists"}