DEV Community

Darío Chiappello
Darío Chiappello

Posted on

Introducing GUMP: Unified, Reactive Configuration Management for Go

Configuration management in Go can get messy pretty fast.
You start with a simple JSON file, then add environment variables, then need live reloads… and suddenly your code is full of boilerplate, manual merges, and type assertions.

That’s why I built GUMP (Go Unified Management Package) — a unified, reactive, and extensible way to manage configuration in Go.

Why GUMP?

Multi-source support → JSON files, environment variables, and more.

Smart merging → hierarchical config merging with overrides.

Real-time updates → automatically reload config when files change.

Typed access → no more interface{} headaches, just GetString, GetInt, etc.

Caching → fast, thread-safe access with selective invalidation.

It’s designed to be modular, extensible, and reliable, so you can focus on your application logic, not config plumbing.

🚀 Quick Example

package main

import (
    "fmt"
    "time"

    "github.com/DarioChiappello/gump/config"
)

func main() {
    cfg, err := config.NewConfigBuilder().
        AddJSONFile("base_config.json").
        AddJSONFile("overrides.json").
        AddEnv("APP_").
        Build()

    if err != nil {
        panic(err)
    }

    cachedCfg := config.NewConfigWithCache(cfg)

    watcher, _ := config.NewConfigWatcher(cachedCfg, 5*time.Second, "config.json")
    watcher.OnReload(func(c *config.Config) {
        fmt.Println("Configuration updated!")
        cachedCfg.InvalidateCache()
    })
    go watcher.Start()
    defer watcher.Stop()

    dbHost := cachedCfg.GetString("database.host", "localhost")
    dbPort := cachedCfg.GetInt("database.port", 5432)

    fmt.Printf("Connecting to %s:%d\n", dbHost, dbPort)
}

Enter fullscreen mode Exit fullscreen mode

That’s all it takes: multi-source loading + caching + live reloads.

🔍 Advanced Features

ConfigWatcher → callbacks on file changes.

EnvLoader → auto-convert APP_DB_HOST → db.host.

ConfigBuilder → fluent chaining API.

ConfigWithCache → fast access, thread-safe.

You can see more examples in the README
.

Why You Might Care

🧩 Modular → clean separation of logic.

🔌 Extensible → easy to add new sources or hooks.

🧼 Readable → context-aware, descriptive errors.

🛡️ Reliable → handles edge cases gracefully.

Fast → in-memory caching for high-performance access.

🔄 Reactive → instant reload on file changes.

🤝 I’d Love Your Feedback

This is still a young project, and I’d love to hear from the Go community:

Is the API intuitive?

Are the defaults sensible?

Any missing features you’d expect in a config library?

👉 Try it out:

go get github.com/DarioChiappello/gump
Enter fullscreen mode Exit fullscreen mode

And let me know what you think!

📄 Links

GitHub repo: github.com/DarioChiappello/gump

License: MIT

Top comments (0)