Skip to content

Go

Step 1: Add the Skpr config module

go get github.com/skpr/go-config

Step 2: Import the module

import skprconfig "github.com/skpr/go-config"

Step 3: Load the config

skprconfig, err := skprconfig.Load()
if err != nil && !errors.Is(err, skprconfig.ErrNotFound) {
    panic(err)
}

Step 4: Get the config values

// Get a string value.
bar, ok := skprconfig.Get("token")
if !ok {
  panic("token config key not found")
}