{"id":18473843,"url":"https://github.com/xmidt-org/praetor","last_synced_at":"2025-05-13T00:52:26.675Z","repository":{"id":203229789,"uuid":"709122257","full_name":"xmidt-org/praetor","owner":"xmidt-org","description":"Praetor provides a simple, opinionated way of integrating consul, especially service discovery, into a go.uber.org/fx application.","archived":false,"fork":false,"pushed_at":"2025-05-05T20:07:13.000Z","size":217,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-13T00:52:21.215Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xmidt-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2023-10-24T03:57:25.000Z","updated_at":"2025-05-05T20:07:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"ebe4b15d-2b81-4a98-aaba-c91c0d88b304","html_url":"https://github.com/xmidt-org/praetor","commit_stats":null,"previous_names":["xmidt-org/praetor"],"tags_count":1,"template":false,"template_full_name":"xmidt-org/.go-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmidt-org%2Fpraetor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmidt-org%2Fpraetor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmidt-org%2Fpraetor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmidt-org%2Fpraetor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xmidt-org","download_url":"https://codeload.github.com/xmidt-org/praetor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850889,"owners_count":21973672,"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":[],"created_at":"2024-11-06T10:26:44.917Z","updated_at":"2025-05-13T00:52:26.662Z","avatar_url":"https://github.com/xmidt-org.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# praetor\n\npraetor integrates go.uber.org/fx with consul.\n\n[![Build Status](https://github.com/xmidt-org/praetor/workflows/CI/badge.svg)](https://github.com/xmidt-org/praetor/actions)\n[![codecov.io](http://codecov.io/github/xmidt-org/praetor/coverage.svg?branch=main)](http://codecov.io/github/xmidt-org/praetor?branch=main)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xmidt-org/praetor)](https://goreportcard.com/report/github.com/xmidt-org/praetor)\n[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/xmidt-org/praetor/blob/main/LICENSE)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xmidt-org_PROJECT\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=xmidt-org_PROJECT)\n[![GitHub release](https://img.shields.io/github/release/xmidt-org/praetor.svg)](CHANGELOG.md)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/xmidt-org/praetor)](https://pkg.go.dev/github.com/xmidt-org/praetor)\n\n## Summary\n\nPraetor provides a basic, opinionated way of integrating consul into a go.uber.org/fx application.\n\n## Table of Contents\n\n- [Usage](#usage)\n- [Code of Conduct](#code-of-conduct)\n- [Install](#install)\n- [Contributing](#contributing)\n\n## Usage\n\n`praetor.Provide()` creates an `*api.Client` object as well as several of the commonly used services.\n\n```go\nimport github.com/xmidt-org/praetor\n\napp := fx.New(\n    praetor.Provide(),\n    fx.Invoke(\n        // praetor.Provide() makes the following possible:\n        func(client *api.Config) {\n            // ...\n        },\n        func(agent *api.Agent) {\n            // ...\n        },\n        func(agent *api.Catalog) {\n            // ...\n        },\n        func(agent *api.Health) {\n            // ...\n        },\n        func(agent *api.KV) {\n            // ...\n        },\n    ),\n)\n```\n\nIf an `api.Config` is provided within the application, it will be used to create the consul client.\n\n```go\nimport github.com/xmidt-org/praetor\n\napp := fx.New(\n    fx.Supply(\n        // this api.Config can come from external sources\n        api.Config{\n            Scheme: \"https\",\n            Address: \"foobar.com\",\n        }\n    ),\n    praetor.Provide(),\n)\n```\n\nA custom configuration can be easily integrated using the standard `go.uber.org/fx` tools.\n\n```go\nimport github.com/xmidt-org/praetor\n\ntype MyConfiguration struct {\n    Scheme string\n    Address string\n\n    // anything else desired ....\n}\n\napp := fx.New(\n    fx.Supply(\n        MyConfiguration{\n            Scheme: \"https\",\n            Address: \"foobar.com\",\n        }\n    ),\n    praetor.Provide(),\n    fx.Provide(\n        // this will be used by praetor\n        func(src MyConfiguration) api.Config {\n            return api.Config{\n                Scheme: src.Scheme,\n                Address: src.Address,\n            }\n        },\n    ),\n)\n```\n\n## Code of Conduct\n\nThis project and everyone participating in it are governed by the [XMiDT Code Of Conduct](https://xmidt.io/docs/community/code_of_conduct/). \nBy participating, you agree to this Code.\n\n## Install\n\ngo get -u github.com/xmidt-org/praetor\n\n## Contributing\n\nRefer to [CONTRIBUTING.md](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmidt-org%2Fpraetor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxmidt-org%2Fpraetor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmidt-org%2Fpraetor/lists"}