{"id":18794829,"url":"https://github.com/acerv/etcdgo","last_synced_at":"2026-04-12T18:41:57.813Z","repository":{"id":57427048,"uuid":"253288512","full_name":"acerv/etcdgo","owner":"acerv","description":"Library to push/pull configuration files into etcd distributed database.","archived":false,"fork":false,"pushed_at":"2020-04-18T16:11:23.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-30T06:46:30.109Z","etag":null,"topics":["automation","database","etcd","ini","json","python","python3","yaml"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/etcdgo/","language":"Python","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/acerv.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":"2020-04-05T17:10:01.000Z","updated_at":"2020-04-19T08:06:01.000Z","dependencies_parsed_at":"2022-09-19T06:51:27.757Z","dependency_job_id":null,"html_url":"https://github.com/acerv/etcdgo","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acerv%2Fetcdgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acerv%2Fetcdgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acerv%2Fetcdgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acerv%2Fetcdgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acerv","download_url":"https://codeload.github.com/acerv/etcdgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239719148,"owners_count":19685895,"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":["automation","database","etcd","ini","json","python","python3","yaml"],"created_at":"2024-11-07T21:31:13.719Z","updated_at":"2025-12-29T22:30:14.421Z","avatar_url":"https://github.com/acerv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/acerv/etcdgo.svg?branch=master)](https://travis-ci.org/acerv/etcdgo)\n\nIntroduction\n============\n\netcdgo is a library to push/pull configurations inside [etcd](https://etcd.io)\ndatabases. Supported filetypes are the following:\n\n* JSON\n* Yaml\n* INI\n\nUsage example:\n\n```python\nimport etcd3\nimport etcdgo\n\nclient = etcd3.Etcd3Client(host='127.0.0.1', port=4003)\n\n# push a json configuration inside database\nconfig = etcdgo.get_config(client, \"json\")\nconfig.push(\"myconfig\", \"myfile.json\")\n\n# push a yaml configuration inside database\nconfig = etcdgo.get_config(client, \"yaml\")\nconfig.push(\"myconfig\", \"myfile.yaml\")\n\n# push a ini configuration inside database\nconfig = etcdgo.get_config(client, \"ini\")\nconfig.push(\"myconfig\", \"myfile.ini\")\n\n# pull data from etcd database\ndata = config.pull(\"myconfig\")\n```\n\nTo install the library:\n\n```bash\npip install etcdgo\n```\n\nPush/pull via command line\n==========================\n\netcdgo library contains a tool called ``etcdgo-cli`` which can be used to\npush/pull configurations inside an etcd database.\n\n```bash\n# push ini configuration\n$ etcdgo-cli \\\n    --hostname 10.0.1.21 \\\n    --port 2379 \\\n    --basefile /configs \\\n    push pytest0 pytest.ini\n\n# pull configuration\n$ etcdgo-cli \\\n    --hostname 10.0.1.21 \\\n    --port 2379 \\\n    --basefile /configs \\\n    pull --output-type=ini pytest0\n[pytest]\naddopts = -vv -s\nlog_cli = True\nlog_level = DEBUG\n```\n\n``etcdgo-cli`` will automatically recognize the file extension and push it as\nneeded, but pull command needs to specify the output type, via ``--output-type``\noption.\n\nHow data is stored\n==================\n\nBefore pushing configurations inside an etcd database, all files are converted\ninto a dictionary and then flatten. The ``basefolder`` is given to the configuration\nobject and it's the root of our configurations.\n\nFor example:\n\n```python\nimport etcd3\nimport etcdgo\n\nclient = etcd3.Etcd3Client(host='127.0.0.1', port=4003)\nconfig = etcdgo.get_config(client, \"ini\", basefolder=\"/configs\")\nconfig.push(\"foods\", \"myconfig.ini\")\n```\n\nOur ``myconfig.ini`` configuration:\n\n```ini\n[apple]\ncolor = red\ntaste = sweet\n\n[coffee]\ncolor = black\ntaste = bitter\n```\n\nOnce ``myconfig.ini`` is pushed into etcd, it will be flatten as following:\n\n```etcd\n/configs/foods/apple/color = 'red'\n/configs/foods/apple/taste = 'sweet'\n/configs/foods/coffee/color = 'black'\n/configs/foods/coffee/taste = 'bitter'\n```\n\nYaml/JSON configurations are flatten with the same principle. In this case,\n**lists are stored as strings**.\n\nFor example:\n\n```python\nimport etcd3\nimport etcdgo\n\nclient = etcd3.Etcd3Client(host='127.0.0.1', port=4003)\nconfig = etcdgo.get_config(client, \"json\", basefolder=\"/configs\")\nconfig.push(\"foods\", \"myconfig.json\")\n```\n\nOur ``myconfig.json`` configuration:\n\n```json\n{\n    \"fruits\" : {\n        \"apple\" : {\n            \"color\": \"red\",\n            \"taste\": \"sweet\"\n        },\n        \"coffee\" : {\n            \"color\": \"black\",\n            \"taste\": \"bitter\"\n        },\n    },\n    \"sets\" : [\"fruits\", \"vegetables\" ]\n}\n```\n\nOnce ``myconfig.json`` is pushed into etcd, it will be flatten as following:\n\n```etcd\n/configs/foods/fruits/apple/color = 'red'\n/configs/foods/fruits/apple/taste = 'sweet'\n/configs/foods/fruits/coffee/color = 'black'\n/configs/foods/fruits/coffee/taste = 'bitter'\n/configs/foods/sets = '[\"fruits\", \"vegetables\"]'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facerv%2Fetcdgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facerv%2Fetcdgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facerv%2Fetcdgo/lists"}