{"id":29790976,"url":"https://github.com/metabrainz/gitzconsul","last_synced_at":"2026-04-13T11:01:22.319Z","repository":{"id":137628829,"uuid":"337410832","full_name":"metabrainz/gitzconsul","owner":"metabrainz","description":"Clone a git repo containing json files, and keep a consul kv in sync with it (similar to git2consul)","archived":false,"fork":false,"pushed_at":"2023-05-17T10:35:17.000Z","size":170,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-28T00:21:39.273Z","etag":null,"topics":["consul","consul-kv","docker","git","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metabrainz.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,"zenodo":null},"funding":{"custom":["https://metabrainz.org/donate"],"github":["metabrainz"]}},"created_at":"2021-02-09T13:19:47.000Z","updated_at":"2022-04-09T09:19:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"52d3a551-9705-4a05-9112-fd99e9b884c8","html_url":"https://github.com/metabrainz/gitzconsul","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/metabrainz/gitzconsul","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabrainz%2Fgitzconsul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabrainz%2Fgitzconsul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabrainz%2Fgitzconsul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabrainz%2Fgitzconsul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metabrainz","download_url":"https://codeload.github.com/metabrainz/gitzconsul/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabrainz%2Fgitzconsul/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31749763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["consul","consul-kv","docker","git","python3"],"created_at":"2025-07-28T00:13:26.375Z","updated_at":"2026-04-13T11:01:22.312Z","avatar_url":"https://github.com/metabrainz.png","language":"Python","funding_links":["https://metabrainz.org/donate","https://github.com/sponsors/metabrainz"],"categories":[],"sub_categories":[],"readme":"# gitzconsul\n\nA Python alternative to git2consul\n\n## Install poetry\n\nhttps://python-poetry.org/docs/#installation\n\n## Dev env\n\n```bash\npoetry shell\npoetry install\ngitzconsul --help\n```\n\n## Dependencies\n\n- `git` command\n- python \u003e= 3.8\n- python3 `requests` and `click` modules (see `pyproject.toml`)\n\n## Usage\n\n```\nUsage: gitzconsul [OPTIONS]\n\n  Register kv values into consul based on git repository content\n\nOptions:\n  -r, --root TEXT                 root directory to read files from, relative\n                                  to directory  [default: ]\n\n  -d, --directory TEXT            directory of the repository, will be created\n                                  if needed  [required]\n\n  -g, --git-url TEXT              git repository remote url\n  -R, --git-ref TEXT              git repository remote ref  [default:\n                                  refs/heads/master]\n\n  -k, --consul-key TEXT           add keys under this key  [required]\n  -u, --consul-url TEXT           consul url  [default: http://localhost:8500]\n  -i, --interval INTEGER          interval in seconds between syncs  [default:\n                                  15]\n\n  -a, --consul-datacenter TEXT    consul datacenter\n  -t, --consul-token TEXT         consul token\n  -T, --consul-token-file TEXT    path to file containing consul token\n  -f, --logfile TEXT              log file path\n  -l, --loglevel [CRITICAL|ERROR|WARNING|INFO|DEBUG]\n                                  log level  [default: INFO]\n  -G, --debug                     output extra debug info\n  --help                          Show this message and exit.\n```\n\nTypical directory structure will be:\n\n```\ntopdir/\n├── dir1\n│   ├── file2.json\n│   └── subdir1\n│       ├── file1.json\n│       └── ignored.txt\n└── dir2\n    └── somestuff\n```\n\nTypical `file1.json` (and `file2.json` for this example) would contain something like:\n\n```json\n{\n  \"key1\": \"foo\",\n  \"key2\": {\n    \"key3\": \"bar\"\n  }\n}\n```\n\n```bash\ngitzconsul --directory topdir/ --root dir1 --consul-key mytopkey\n```\n\n```bash\ncurl http://localhost:8500/v1/kv/mytopkey?keys\n```\n\n```json\n[\n    \"mytopkey/file2.json/key1\",\n    \"mytopkey/file2.json/key2/key3\",\n    \"mytopkey/subdir1/file1.json/key1\",\n    \"mytopkey/subdir1/file1.json/key2/key3\"\n]\n```\n\n- Files not ending with `.json` or unparseable json files are ignored.\n- Directory specified by `--root` isn't prepended to keys and any content outside of it is ignored.\n- JSON file names are used as keys (it keeps the extension)\n- If a previously parsed json file becomes unparseable, keys related to it are left untouched.\n\n\n## Docker\n\n### Available images\n\n\nOfficial docker images are available from [Docker Hub](https://hub.docker.com/r/metabrainz/gitzconsul)\n\n```bash\ndocker pull metabrainz/gitzconsul\n```\n\n#### Available tags\n\n- `latest`: the latest released image\n- `vA.B.C`: released versionned image\n- `edge`: the last build, upon last commit of the main github branch\n\n\n### Build Image\n\n```bash\ndocker build . -t gitzconsul\n```\n\n\nIt will look for ssh files in /tmp/.ssh and copy them over proper user's home with proper perms:\n\n```\n/tmp/.ssh/id_rsa_shared\n/tmp/.ssh/config\n/tmp/.ssh/known_hosts\n```\n\nSee `entrypoint.sh`\n\n### Running\n\n```bash\ndocker run --rm gitzconsul --help\n```\n\n### Examples\n\nIf git repository isn't public, you'll need to setup a deploy key, and pass it to the container.\n\n```bash\nssh-keygen -t ed25519 -C 'gitzconsul' -P '' -f ./id_rsa_shared\n```\n\nAlso to access consul, you may want to use network host mode (depending on your setup): `--net host`\n\nExample of `docker run` command:\n\n```bash\nTOPKEY=mytopkey\nDIRROOT=dir1\nGITREPO=git@github.com:domain/project.git\ndocker run \\\n\t--name gitzconsul \\\n\t--volume $(pwd)/id_rsa_shared:/tmp/.ssh/id_rsa_shared:ro \\\n\t--detach \\\n\t--net host \\\n\tgitzconsul \\\n\t\t--root $DIRROOT \\\n\t\t--consul-key $TOPKEY \\\n\t\t--git-url $GITREPO \\\n\t\t--directory /home/gitzconsul/repo\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabrainz%2Fgitzconsul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetabrainz%2Fgitzconsul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabrainz%2Fgitzconsul/lists"}