keyraft_client 0.1.0 copy "keyraft_client: ^0.1.0" to clipboard
keyraft_client: ^0.1.0 copied to clipboard

Dart SDK for Keyraft — lightweight configuration and secrets management (server v0.3.0).

example/keyraft_client_example.dart

import 'dart:io';

import 'package:keyraft_client/keyraft_client.dart';

Future<void> main() async {
  final baseUrl = Platform.environment['KEYRAFT_URL'] ?? 'http://localhost:7200';
  final token = Platform.environment['KEYRAFT_TOKEN'];

  final client = KeyraftClient(baseUrl: baseUrl, token: token);
  try {
    final health = await client.health();
    print('health: $health');

    if (token == null || token.isEmpty) {
      print('Set KEYRAFT_TOKEN to exercise authenticated APIs.');
      return;
    }

    await client.set('demo/dev', 'HELLO', 'world');
    final entry = await client.get('demo/dev', 'HELLO');
    print('get: ${entry.key}=${entry.value} v${entry.version}');

    final me = await client.me();
    print('me: ${me.id} role=${me.role} root=${me.isRoot}');
  } finally {
    client.close();
  }
}
0
likes
150
points
89
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart SDK for Keyraft — lightweight configuration and secrets management (server v0.3.0).

Homepage
Repository (GitHub)
View/report issues

Topics

#config #secrets #key-value #sdk

License

Apache-2.0 (license)

More

Packages that depend on keyraft_client