Skip to content

Releases: qdm12/gosettings

v0.4.0-rc4

22 Nov 10:36
Compare
Choose a tag to compare
v0.4.0-rc4 Pre-release
Pre-release

Breaking changes

  • Move reader/parse to internal/parse

Maintenance

  • Upgrade dependency golang.org/x/exp
  • Upgrade CI Docker image Alpine from 3.16 to 3.18
  • Upgrade Go from 1.20 to 1.21
  • Upgrade actions/checkout from 3 to 4 (#12)

Features

  • reader:
    • add builtin methods: Int8, Int16, Int32, Int64, Int8Ptr, Int16Ptr, Int32Ptr, Int64Ptr, Float32, Float32Ptr and Float64Ptr
    • default reader sources are flags then env isntead of only env

Documentation

  • Simplify README.md reader Go code example
  • Update reader example code to use flag and env instead of both sources as env

v0.4.0-rc3

22 Nov 08:31
Compare
Choose a tag to compare
v0.4.0-rc3 Pre-release
Pre-release

Breaking changes

  • Move environment variables source env.go to its own reader/sources/env package

Features

  • Add flags source package reader/sources/flag

v0.4.0-rc2

21 Nov 18:31
Compare
Choose a tag to compare
v0.4.0-rc2 Pre-release
Pre-release

Breaking changes

  • reader package which replaces all sources packages
    • Merge functions in merge.go removed (now unneeded)
    • Settings reader now reads from multiple sources in order
    • sources/merger removed
    • sources/env removed (replaced by reader package)
    • Define Env reader-compatible Source
    • parse package generic functions accept source interfaces instead of keyValues map
    • Update all code comments, example and readme
  • reader package: New takes a Settings struct as its unique argument
  • Number constraint and constraints.go file removed
  • Override: OverrideWithComparable function, replacing OverrideWithNumber, OverrideWithString, OverrideWithPointerRaw, OverrideWithInterface and OverrideWithSliceRaw
  • Defaults: DefaultComparable function, replacing DefaultNumber, DefaultString, DefaultPointerRaw, DefaultInterface and DefaultSliceRaw
  • parse package: try parsing the empty string if AllowEmpty(true) option is used

Features

  • reader package: add DefaultOptions field to the Settings struct
  • reader package: add FirstKeySet function

Fixes

  • reader/parse package:
    • settings default properly set handleDeprecatedKey function
    • parseBool returns a bool pointer

Documentation

  • Review code comments
    • fix godoc comments bullet list formatting
    • fix godoc comments new lines formatting
    • mention default settings for CSV methods
    • change the error context to its message
    • mention nil slices conditions for CSV methods
    • review AcceptEmpty option comment

v0.4.0-rc1

14 Jun 15:03
c8d5bcb
Compare
Choose a tag to compare
v0.4.0-rc1 Pre-release
Pre-release

Features

  • sources/env: add CSVNetipAddresses method

Fixes

  • validate: ListeningAddress accepts empty listening addresses

Documentation

  • sources/env: fix CSVNetipPrefixes method comment

v0.3.0

10 Jun 08:29
407bc1e
Compare
Choose a tag to compare

Features

  • Add ObfuscateKey function
  • Add BoolToYesNo function
  • Add DefaultPointerRaw function
  • sources/env:
    • add ForceLowercase option
    • add AcceptEmpty option
    • add String function as a shorthand to return the empty string if the environment variable is not set or is the empty string.
    • add Uint32Ptr method
    • add Duration method
    • BoolPtr accepts true and false as string values
    • add CSV functions for signed, unsigned and netip prefixes
    • add RetroKeys option
      • Breaking change: New takes handleDeprecatedKey functional argument, which can be left to nil
  • sources/merger package with sources merger generic code
  • validate:
    • add AreAllOneOfCaseInsensitive function
    • add FileExists function
    • add DirectoryExists function
    • add ListeningAddress function
  • Breaking changes:
    • Change MergeWith to be a value receiver and return a merged result
    • sources/env:
      • all functions changed to methods on Env which is created with env.New(os.Environ())
      • Get trims quotes by default
      • add environment variable key in the error context
      • Get returns a string pointer, which is always nil if the variable is not set, and can be nil if empty values are not accepted (default). Most functions still return nil if they get an empty string (i.e. Uint8Ptr)

Fixes

  • sources/env: trim both spaces and new lines if both are specified
  • validate: fix orStrings function
  • MergeWithSlice with nil arguments

Documentation

  • Readme: update features section
  • Readme: fully revised
  • Readme: add gluetun, dns and tinier as concrete examples
  • Add comments to all exported members
  • Add examples/merger/main.go
  • Add Names string slice field to example settings in example/settings/settings.go
  • sources/env:
    • document Get default behavior
    • add Test_New test

Maintenance

  • Drop dependency on github.com/qdm12/govalid:
    • sources/env: add unsigned and signed local parse functions
    • sources/env: package local parseBool
  • sources/env:
    • split Get body into postProcessValue function
    • Get has a more flexible value trimming logic
  • Enforce exported comments with linter, except for sentinel errors

v0.3.0-rc14

09 Jun 12:02
c601cb7
Compare
Choose a tag to compare
v0.3.0-rc14 Pre-release
Pre-release

Documentation

  • sources/env: comment on order of retro keys

Features

  • sources/env: add Duration method

v0.3.0-rc13

05 Jun 08:41
e3fac87
Compare
Choose a tag to compare
v0.3.0-rc13 Pre-release
Pre-release

Features

  • sources/env: add Uint32Ptr
  • sources/env: BoolPtr accepts true and false as string values
  • sources/env: add CSV functions for signed, unsigned and netip prefixes
  • sources/env: add RetroKeys option
    • Breaking change: New takes handleDeprecatedKey functional argument, which can be left to nil

Maintenance

  • Drop dependency on qdm12/govalid:
    • sources/env: add unsigned and signed local parse functions
    • sources/env: package local parseBool

v0.3.0-rc12

01 Jun 09:58
2ded02e
Compare
Choose a tag to compare
v0.3.0-rc12 Pre-release
Pre-release
  • Fix: MergeWithSlice with nil arguments
  • Maintenance: sources/env: add Test_New test

v0.3.0-rc11

31 May 20:19
4a679b5
Compare
Choose a tag to compare
v0.3.0-rc11 Pre-release
Pre-release
change(sources/env): all functions changed to methods on `Env`

v0.3.0-rc10

31 May 10:41
4fb5ea8
Compare
Choose a tag to compare
v0.3.0-rc10 Pre-release
Pre-release
fix(validate): `orStrings` function