01-basic

command
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 3 Imported by: 0

README

Example 01: Basic Usage

The simplest possible confkit example demonstrating core concepts.

What This Shows

  • Creating a configuration
  • Adding a layer with values
  • Getting values with GetValue (simple)
  • Getting values with Get (with source info)
  • Key normalization (dot, underscore, hyphen, case)

Running

go run main.go

Key Points

  1. Layers - Configuration is organized in named layers
  2. Key-Value - Simple string key-value storage
  3. GetValue - Returns just the value and whether it was found
  4. Get - Returns value, source key, layer name, and found status
  5. Normalization - Different key formats resolve to the same value

Output

Application: MyApp
Port: 8080 (from layer 'defaults', key: server.port)

Key normalization test:
  server.host → localhost
  server_host → localhost
  server-host → localhost
  SERVER_HOST → localhost
  SERVER.HOST → localhost

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL