{"id":27253433,"url":"https://github.com/marselester/dynconf","last_synced_at":"2025-04-11T01:27:34.369Z","repository":{"id":57641588,"uuid":"432318317","full_name":"marselester/dynconf","owner":"marselester","description":"Dynamic service configuration with etcd.","archived":false,"fork":false,"pushed_at":"2021-12-06T22:06:15.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T06:37:08.854Z","etag":null,"topics":["dynamic-configuration","etcd"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"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/marselester.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}},"created_at":"2021-11-26T22:47:54.000Z","updated_at":"2021-12-06T22:06:18.000Z","dependencies_parsed_at":"2022-09-07T03:53:14.648Z","dependency_job_id":null,"html_url":"https://github.com/marselester/dynconf","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/marselester%2Fdynconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Fdynconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Fdynconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Fdynconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marselester","download_url":"https://codeload.github.com/marselester/dynconf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248324232,"owners_count":21084670,"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":["dynamic-configuration","etcd"],"created_at":"2025-04-11T01:27:32.202Z","updated_at":"2025-04-11T01:27:34.356Z","avatar_url":"https://github.com/marselester.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamic service configuration\n\nThis Go package provides a dynamic service configuration backed by etcd,\nso there should be no need to redeploy a service to change its settings.\n\nFor example, project Curiosity expects settings such as `velocity = 10` and `is_camera_enabled = true`.\nLet's save them in etcd with a path prefix `/configs/curiosity/`.\n\n```sh\n$ brew install etcd\n$ etcd\n$ etcdctl put /configs/curiosity/velocity 10\nOK\n$ etcdctl put /configs/curiosity/is_camera_enabled true\nOK\n```\n\nOn the service side the settings are fetched from the same path.\n\n```go\nconst defaultVelocity = 5\n\nc, err := dynconf.New(\"/configs/curiosity/\")\nif err != nil {\n\t// No worries if etcd is down, the rover can still roll with the default settings.\n}\ndefer c.Close()\n\nrover.SetVelocity(\n\tc.Int(\"velocity\", defaultVelocity),\n)\n```\n\n## Testing\n\nRun etcd (`127.0.0.1:2379` by default) and then launch the tests.\n\n```sh\n$ etcd\n$ go test -count=1 .\n```\n\n### Toxiproxy\n\nWith [Toxiproxy](https://github.com/Shopify/toxiproxy) you can simulate network conditions.\nAll communication with the Toxiproxy daemon from the client happens via HTTP on port 8474.\n\n```sh\n$ brew install toxiproxy\n$ toxiproxy-server\nINFO[0000] API HTTP server starting                      host=localhost port=8474 version=2.2.0\n```\n\nCreate a proxy called `dynconf_etcd` that listens on port `22379`\nand proxies traffic to etcd running on `2379` port.\n\n```sh\n$ toxiproxy-cli create --listen localhost:22379 --upstream localhost:2379 dynconf_etcd\nCreated new proxy dynconf_etcd\n$ toxiproxy-cli list\nName\t\t\tListen\t\tUpstream\t\tEnabled\t\tToxics\n======================================================================================\ndynconf_etcd\t\t127.0.0.1:22379\tlocalhost:2379\t\tenabled\t\tNone\n```\n\nCheck that etcd is reachable via Toxiproxy.\n\n```sh\n$ etcdctl --endpoints=127.0.0.1:22379 get /configs/curiosity/velocity\nOK\n```\n\nAdd 1500ms downstream latency.\n\n```sh\n$ toxiproxy-cli toxic add --type latency --attribute latency=1500 dynconf_etcd\n$ toxiproxy-cli inspect dynconf_etcd\nName: dynconf_etcd\tListen: 127.0.0.1:22379\tUpstream: localhost:2379\n======================================================================\nUpstream toxics:\nProxy has no Upstream toxics enabled.\n\nDownstream toxics:\nlatency_downstream:\ttype=latency\tstream=downstream\ttoxicity=1.00\tattributes=[\tjitter=0\tlatency=5000\t]\n```\n\nThere should be 1.5s latency introduced.\nYou can remove `latency_downstream` afterwards.\n\n```sh\n$ etcdctl --endpoints=127.0.0.1:22379 get /configs/curiosity/velocity\nOK\n$ toxiproxy-cli toxic remove -n latency_downstream dynconf_etcd\nRemoved toxic 'latency_downstream' on proxy 'dynconf_etcd'\n```\n\nThere are more [toxics](https://github.com/Shopify/toxiproxy#toxics) available.\nFor example, stop all data from getting through, and close the connection after 10s.\n\n```sh\n$ toxiproxy-cli toxic add --type timeout --attribute timeout=10000 dynconf_etcd\nAdded downstream timeout toxic 'timeout_downstream' on proxy 'dynconf_etcd'\n$ toxiproxy-cli toxic remove -n timeout_downstream dynconf_etcd\n```\n\nSimulate TCP RESET (Connection reset by peer) by closing connections after 10s.\n\n```sh\n$ toxiproxy-cli toxic add --type reset_peer --attribute timeout=10000 dynconf_etcd\nAdded downstream reset_peer toxic 'reset_peer_downstream' on proxy 'dynconf_etcd'\n$ toxiproxy-cli toxic remove -n reset_peer_downstream dynconf_etcd\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarselester%2Fdynconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarselester%2Fdynconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarselester%2Fdynconf/lists"}