Go to file
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00
2025-11-08 07:16:48 -05:00

Config

Thread-safe configuration management for Go applications with support for multiple sources (files, environment variables, command-line arguments, defaults) and configurable precedence.

Features

  • Multiple Sources: Load configuration from defaults, files, environment variables, and CLI arguments
  • Configurable Precedence: Control which sources override others
  • Type Safety: Struct-based configuration with automatic validation
  • Thread-Safe: Concurrent access with read-write locking
  • File Watching: Automatic reloading on configuration changes
  • Source Tracking: Know exactly where each value came from
  • Tag Support: Use toml, json, or yaml struct tags

Installation

go get github.com/lixenwraith/config

Quick Start

package main

import (
    "log"
    "github.com/lixenwraith/config"
)

type AppConfig struct {
    Server struct {
        Host string `toml:"host"`
        Port int    `toml:"port"`
    } `toml:"server"`
    Debug bool `toml:"debug"`
}

func main() {
    defaults := &AppConfig{}
    defaults.Server.Host = "localhost"
    defaults.Server.Port = 8080

    cfg, err := config.Quick(defaults, "MYAPP_", "config.toml")
    if err != nil {
        log.Fatal(err)
    }

    port, _ := cfg.Get("server.port")
    log.Printf("Server port: %d", port.(int64))
}

Documentation

License

BSD-3-Clause

Description
No description provided
Readme BSD-3-Clause 503 KiB
Languages
Go 100%