https://github.com/adaptant-labs/consul-dart
Consul API for Dart
https://github.com/adaptant-labs/consul-dart
consul consul-api dart dart-library rest rest-api
Last synced: about 1 year ago
JSON representation
Consul API for Dart
- Host: GitHub
- URL: https://github.com/adaptant-labs/consul-dart
- Owner: adaptant-labs
- License: apache-2.0
- Created: 2020-05-14T10:29:12.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T20:16:15.000Z (over 3 years ago)
- Last Synced: 2025-02-05T18:06:38.985Z (over 1 year ago)
- Topics: consul, consul-api, dart, dart-library, rest, rest-api
- Language: Dart
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Consul API for Dart
[](https://travis-ci.com/adaptant-labs/consul-dart#)
[](https://pub.dev/packages/consul)
This provides an implementation of the HashiCorp Consul REST API in Dart.
## Overview
This is a work in progress, and only implements a subset of the APIs at present. This has primarily been designed with
the aim of allowing Dart-based microservices to register and unregister themselves and their corresponding health checks
with the Consul Agent, so this has been the initial implementation focus.
Implementation of the other APIs will gradually follow.
## Usage
A simple usage example:
```dart
import 'package:consul/consul.dart';
main() {
// Connect to the local Consul Agent
var consul = Consul(host: 'localhost', port: 8500);
var agent = ConsulAgent(consul: consul);
// Register a new test service and health check.
var serviceRegistration = AgentServiceRegistration(
name: 'test-service',
address: 'localhost',
port: 12345,
check: AgentServiceCheck(
name: 'test-service-check',
interval: '30s',
http: 'http://localhost:12345/health',
),
);
await agent.registerService(serviceRegistration);
... do something ...
await agent.deregisterService('test-service');
}
```
## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/adaptant-labs/consul-dart/issues
## License
Licensed under the terms of the Apache 2.0 license.