{"id":13483924,"url":"https://github.com/rogerwelin/crystal-consul","last_synced_at":"2025-05-12T22:11:40.671Z","repository":{"id":73411280,"uuid":"200550940","full_name":"rogerwelin/crystal-consul","owner":"rogerwelin","description":"Crystal client for Consul (http://www.consul.io/)","archived":false,"fork":false,"pushed_at":"2020-04-22T21:22:31.000Z","size":90,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T22:11:10.329Z","etag":null,"topics":["consul","consul-api","crystal","crystal-lang"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/rogerwelin.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}},"created_at":"2019-08-04T23:16:19.000Z","updated_at":"2025-02-13T07:41:18.000Z","dependencies_parsed_at":"2023-02-28T00:16:16.574Z","dependency_job_id":null,"html_url":"https://github.com/rogerwelin/crystal-consul","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/rogerwelin%2Fcrystal-consul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogerwelin%2Fcrystal-consul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogerwelin%2Fcrystal-consul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogerwelin%2Fcrystal-consul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogerwelin","download_url":"https://codeload.github.com/rogerwelin/crystal-consul/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830956,"owners_count":21971004,"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":["consul","consul-api","crystal","crystal-lang"],"created_at":"2024-07-31T17:01:16.909Z","updated_at":"2025-05-12T22:11:40.601Z","avatar_url":"https://github.com/rogerwelin.png","language":"Crystal","funding_links":[],"categories":["Third-party APIs"],"sub_categories":[],"readme":"# 💎 crystal-consul\n\n[![Language](https://img.shields.io/badge/language-crystal-776791.svg)](https://github.com/crystal-lang/crystal)\n[![Build Status](https://travis-ci.org/rogerwelin/crystal-consul.svg?branch=master)](https://travis-ci.org/rogerwelin/crystal-consul)\n[![GitHub release](https://img.shields.io/github/release/rogerwelin/crystal-consul.svg)](https://github.com/rogerwelin/crystal-consul/releases)\n\n\nCrystal client for Consul HTTP API. For more information about the Consul HTTP API, go [here](https://www.consul.io/api/index.html).\nCrystal-consul does not use any depenencies outside stdlib, hence no transitive dependencies when you include it in your project. \n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     crystal-consul:\n       github: rogerwelin/crystal-consul\n   ```\n\n2. Run `shards install`\n\n## Example Usage\n\n```crystal\nrequire \"crystal-consul\"\n\n# create a default client\nc = Consul.client()\n\n# create a key\nc.kv.create_key(\"stage/service-example/version\", \"1\")\nc.kv.create_key(\"stage/service-example/tag\", \"master\")\n\n# read key\nc.kv.get_key(\"stage/service-example/version\")\n# Consul::Types::KV::KvPair(@key=\"stage/service-example/version\", @value=\"1\")\n\n# you can also get keys recursively\nc.kv.get_key(\"stage\", recurse: true)\n# [Consul::Types::KV::KvPair(@key=\"stage/service-example/tag\", @value=\"master\"), Consul::Types::KV::KvPair(@key=\"stage/service-example/version\", @value=\"1\")]\n\n# register a service on the local agent\nservice = Consul::Service.new()\nservice.service = \"service-example\"\nservice.tags = [\"master\"]\nservice.port = 9922\n\nc.agent.register_service(service)\n```\n\nFor more examples and usage view [the example page](https://github.com/rogerwelin/crystal-consul/blob/master/examples/examples.md)\n\n\n## Project Status\n\nImplemented endpoints implements all consistency modes, filter options and query parameters as specified by Consul HTTP API doc.\n\n#### Completed  \n- [x] Agent\n- [x] KV Store\n- [x] Catalog\n- [x] Coordinates\n- [x] Events\n- [x] Health\n- [x] Snapshots\n- [x] Status\n\n\n#### TO-DO  \n- [ ] ACLs\n- [ ] Config\n- [ ] Connect\n- [ ] Operator\n- [ ] Prepared Queries\n- [ ] Sessions\n- [ ] Transactions\n\n## Testing\n\nOnly a working Crystal installation and Docker is required. Project does not use mocks, instead all endpoints are tested against a running Consul docker container.\n\n1. Run ```docker run -d -p 8500:8500 consul:1.5.1```\n2. Run ```crystal spec``` from the project root\n\n## Contributing\n\nPull requests are very much appreciated! When you create a PR please ensure:\n\n* All current tests pass  \n* To run ```crystal tool format``` on added code  \n* To add tests for your new features, if applicable  \n* To add doc comments for new api features you add  \n\n\n1. Fork it (\u003chttps://github.com/rogerwelin/crystal-consul/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Roger Welin](https://github.com/rogerwelin) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogerwelin%2Fcrystal-consul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogerwelin%2Fcrystal-consul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogerwelin%2Fcrystal-consul/lists"}