{"id":15979165,"url":"https://github.com/perry-mitchell/user-config","last_synced_at":"2025-05-07T06:43:58.920Z","repository":{"id":74696452,"uuid":"90177814","full_name":"perry-mitchell/user-config","owner":"perry-mitchell","description":"Easy user application configuration management","archived":false,"fork":false,"pushed_at":"2017-05-03T19:53:28.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T13:10:27.022Z","etag":null,"topics":["config","configuration","configuration-file","nodejs","settings","settings-storage","user-profile"],"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/perry-mitchell.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-03T17:56:06.000Z","updated_at":"2018-03-15T02:00:19.000Z","dependencies_parsed_at":"2023-02-25T07:45:45.790Z","dependency_job_id":null,"html_url":"https://github.com/perry-mitchell/user-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuser-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuser-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuser-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuser-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perry-mitchell","download_url":"https://codeload.github.com/perry-mitchell/user-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252831176,"owners_count":21810779,"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":["config","configuration","configuration-file","nodejs","settings","settings-storage","user-profile"],"created_at":"2024-10-07T23:41:27.192Z","updated_at":"2025-05-07T06:43:58.908Z","avatar_url":"https://github.com/perry-mitchell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# user-config\nEasy user application configuration management\n\n[![Build Status](https://travis-ci.org/perry-mitchell/user-config.svg?branch=master)](https://travis-ci.org/perry-mitchell/user-config) [![npm version](https://badge.fury.io/js/user-config.svg)](https://www.npmjs.com/package/user-config)\n\n## Usage\nWhen requiring the library, **user-config** returns a function which is used to instantiate a config object that allows getting and setting of config values:\n\n```javascript\nconst createConfig = require(\"user-config\");\n\nconst config = createConfig(\"my-app\");\n\n// items in config are stored in objects and must be serialisable\nconfig.set(\"some.config.item\", 123);\n```\n\nConfiguration changes should be saved after being changed:\n\n```javascript\nconst config = require(\"user-config\")(\"my-app\");\n\nconfig.set(\"port\", 443);\nconfig.save();\n```\n\nValues can easily be retrieved from the store, including entire objects:\n\n```javascript\nconst config = require(\"user-config\")(\"my-app\");\n\nconsole.log(`Application running on interface ${config.get(\"listen.ip\")}`);\n```\n\n### Templating\nOutdated configurations can be updated using a templating system. By passing a template to the creation of the config store, old configurations can be merged with the template to ensure the presence of keys and structures:\n\n```javascript\nconst createConfig = require(\"user-config\");\n\nconst TEMPLATE = {\n    ip: \"0.0.0.0\",\n    encryption: {\n        mode: \"aes-gcm\"\n    }\n}\nconst config = createConfig(\"my-app\", TEMPLATE);\nconfig.get(\"encryption.mode\"); // \"aes-gcm\"\n```\n\n## Browser usage\nWhen being used in the context of a browser, **user-config** knows to use `localStorage` instead of the filesystem. Storage switching is transparent.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fuser-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperry-mitchell%2Fuser-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fuser-config/lists"}