{"id":15176449,"url":"https://github.com/inaka/nconf","last_synced_at":"2025-10-10T02:10:54.114Z","repository":{"id":35628403,"uuid":"39902354","full_name":"inaka/nconf","owner":"inaka","description":"Nested Configuration Manager for Erlang Applications","archived":false,"fork":false,"pushed_at":"2018-08-06T16:39:42.000Z","size":82,"stargazers_count":11,"open_issues_count":1,"forks_count":3,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-10-04T07:28:47.372Z","etag":null,"topics":["erlang","erlang-application","hacktoberfest","nconf"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2015-07-29T15:52:40.000Z","updated_at":"2025-08-26T06:52:28.000Z","dependencies_parsed_at":"2022-08-17T21:55:40.853Z","dependency_job_id":null,"html_url":"https://github.com/inaka/nconf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/inaka/nconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fnconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fnconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fnconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fnconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaka","download_url":"https://codeload.github.com/inaka/nconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fnconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002528,"owners_count":26083399,"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-10-10T02:00:06.843Z","response_time":62,"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":["erlang","erlang-application","hacktoberfest","nconf"],"created_at":"2024-09-27T13:04:14.623Z","updated_at":"2025-10-10T02:10:54.096Z","avatar_url":"https://github.com/inaka.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nconf\n\nNested Configuration Manager for Erlang Applications\n\n`nconf` is a module for reading the contents of an nconf config file and\nmodifying the configuration parameters accordingly.\n\nThe following commands are available in an nconf config file:\n\n```erlang\n  {set, AppName, ParamName, Path1, ..., PathN, Replacement}\n  {replace, AppName, ParamName, Path1, ..., PathN, Replacement}\n  {unset, AppName, ParamName, Path1, ..., PathN}\n```\n\n## Example\n\nAssume that we have an application that configures some ports and passwords to\nbe used in `sys.config`:\n\n```erlang\n[{myapp,\n   [{ports,\n       [{ftp, 21},\n        {ssh, 22},\n        {http, 80},\n        {ssl, 443},\n        {snmp, 161}],\n    {passwords,\n        [{\"user1\", \"pw1\"},\n         {\"user2\", \"pw2\"}]}}].\n```\n\n**How can users modify the settings**? Let's say a user wants to set the http\nport to 8080, delete the second password and add a third one. The options are the\nfollowing:\n\n1. The user can modify the `sys.config` file itself. This is often not\n   desirable, e.g. when the sys.config is a generated file, or when the next\n   release of our application might contain a different sys.config file with\n   additional default values.\n\n2. The user can create a `user.config` file, use the [-config][1] option when\n   starting `erl`, and thus have the configuration described in `sys.config`\n   updated with the contents of `user.config`. The problem is that configuration\n   values in the `user.config` file will overwrite the values in the\n   `sys.config` files instead of being merged. So the user would need to repeat\n   each configuration parameter in `sys.config` that needs to be updated (such\n   as `ports` and `passwords`):\n\n   ```erlang\n   [{myapp,\n      [{ports,\n          [{ftp, 21},\n           {ssh, 22},\n           {http, 8080},\n           {ssl, 443},\n           {snmp, 161}],\n       {passwords,\n           [{\"user1\", \"pw1\"},\n            {\"user3\", \"pw3\"}]}}].\n   ```\n\n3. Finally, **the user can use nconf** and write the following nconf\n   configuration file:\n\n   ```erlang\n   {set, myapp, ports, http, 80}.\n   {unset, myapp, passwords, \"user2\"}.\n   {set, myapp, passwords, \"user3\", \"pw3\"}.\n   ```\n\n[1]: http://www.erlang.org/doc/man/config.html\n\n## Details\n\nThe configuration entries are organized into a tree. The nconf config file\ncontains a number of tuples, each of which modifies one leaf or branch of this\ntree. Leaves and branches can be replaced (with the `set` and `replace`\ncommands) and deleted (with the `unset` command). The elements of the tuple\n(after the command) specify the path from the root of the configuration tree\ntowards the leaf or branch to be modified or deleted. In case of the `set` and\n`replace` commands, the last element of the tuple defines the new value for the\nleaf or branch.\n\nThe available commands in an nconf config file are the following:\n\n```erlang\n{set, AppName, ParamName, Path1, ..., PathN, Replacement}.\n```\n\nSets the value of a given configuration entry to the given value.\n\n```erlang\n{replace, AppName, ParamName, Path1, ..., PathN, Replacement}.\n```\n\nSets a given configuration entry to the given value. The difference between\n`set` and `replace` is that the former sets only the value, while the latter the\nentry itself. Compare `{set, myapp, myparam, a, 1}` and `{replace, myapp,\nmyparam, a, {a, 1}}`, which perform the same task. The latter can be used to\nset not only a pair, but also a longer tuple as a configuration entry; for\nexample the effect of `{replace, myapp, myparam, a, {a, 1, 2}}` cannot be\nreproduced with `set`. Generally it is a good practice to use `set` whenever\npossible, and use `replace` only when necessary.\n\n```erlang\n{unset, AppName, ParamName, Path1, ..., PathN}.\n```\n\nDeletes the given configuration entry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fnconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaka%2Fnconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fnconf/lists"}