package
0.0.0-20241123081934-5b2a99bd3a3f
Repository: https://github.com/nextpkg/nextcfg.git
Documentation: pkg.go.dev

# README

Flag Source

The flag s reads config from flags

Format

We expect the use of the flag package. Upper case flags will be lower cased. Dashes will be used as delimiters.

Example

dbAddress := flag.String("database_address", "127.0.0.1", "the db address")
dbPort := flag.Int("database_port", 3306, "the db port)

Becomes

{
  "database": {
    "address": "127.0.0.1",
    "port": 3306
  }
}

New Source

flagSource := flag.NewSource(
// optionally enable reading of unset flags and their default
// values into config, defaults to false
IncludeUnset(true)
)

Load Source

Load the s into config

// Create new config
conf := nextcfg.NewConfig()

// Load flag s
conf.Load(flagSource)

# Functions

GetLoader sets flag source.
IncludeUnset toggles the loading of unset flags and their respective default values.
NewSource returns a config source for integrating parsed flags.