go-envconfig

A Go library for parsing struct tags from environment variables.

APACHE-2.0 License

Stars
994
Committers
17

Bot releases are visible (Hide)

go-envconfig - v1.0.3 Latest Release

Published by sethvargo 5 months ago

What's Changed

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v1.0.2...v1.0.3

go-envconfig - v1.0.2

Published by sethvargo 5 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v1.0.1...v1.0.2

go-envconfig - v1.0.1

Published by sethvargo 8 months ago

What's Changed

  • Update Go version to 1.22.1 (security)
go-envconfig - v1.0.0

Published by sethvargo 10 months ago

[!CAUTION]

This release includes breaking changes. Please read these release notes thoroughly.

New features

  • Introduce global and cascading configuration options by @sethvargo in https://github.com/sethvargo/go-envconfig/pull/97

    This introduces the concept of global configurations and cascades struct-level configuration options onto all child fields. For example, marking a struct as required will mark all child fields as required. Similarly, setting a custom delimiter on a struct tag propagates that delimiter to all child fields of the struct. This behavior previously only applied to the noinit tag, but it now applies to all tags.

Breaking changes

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.9.0...v1.0.0-beta1

go-envconfig - v1.0.0-beta1

Published by sethvargo 10 months ago

[!CAUTION]

This release includes breaking changes to prepare for the 1.0 release. Please read these release notes thoroughly and report any bugs or issues. Many of these "breaking changes" are fixing what should have been the correct behavior from the start.

New features

  • Introduce global and cascading configuration options by @sethvargo in https://github.com/sethvargo/go-envconfig/pull/97

    This introduces the concept of global configurations and cascades struct-level configuration options onto all child fields. For example, marking a struct as required will mark all child fields as required. Similarly, setting a custom delimiter on a struct tag propagates that delimiter to all child fields of the struct. This behavior previously only applied to the noinit tag, but it now applies to all tags.

Breaking changes

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.9.0...v1.0.0-beta1

go-envconfig - v0.9.0

Published by sethvargo over 1 year ago

What's Changed

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.8.3...v0.9.0

go-envconfig - v0.8.2

Published by sethvargo about 2 years ago

What's Changed

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.8.1...v0.8.2

go-envconfig - v0.8.1

Published by sethvargo about 2 years ago

What's Changed

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.8.0...v0.8.1

go-envconfig - v0.8.0

Published by sethvargo over 2 years ago

What's Changed

The previous implementation of overwrite would always overwrite values in the given struct, even if values existed. While this is the definition of overwrite, it unintentionally extended to default values as well. So even if a value was explicitly set on a struct, it would be overwritten with the "default" value set in envconfig. This was an unexpected behavior, since defaults should take the lowest precedence.

The new implementation has the following behavior with overwrite:

  • If the struct field has the zero value and a default is set:

    • If no environment variable is specified, the struct field will be populated with the default value.

    • If an environment variable is specified, the struct field will be populate with the environment variable value.

  • If the struct field has a non-zero value and a default is set:

    • If no environment variable is specified, the struct field's existing value will be used (the default is ignored).

    • If an environment variable is specified, the struct field's existing value will be overwritten with the environment variable value.

As part of this change, decoder interfaces are only processed when an environment (or a default) is present.

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.7.0...v0.8.0

go-envconfig - v0.7.0

Published by sethvargo over 2 years ago

What's Changed

  • Change custom unmarshaling order by @gust1n in https://github.com/sethvargo/go-envconfig/pull/59. This changes the order of resolution for unmarshalling to:

    1. envconfig.Decoder
    2. encoding.TextUnmarshaler
    3. json.Unmarshaler
    4. encoding.BinaryUnmarshaler
    5. gob.GobDecoder

New Contributors

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.6.2...v0.7.0

go-envconfig - v0.6.2

Published by sethvargo over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.6.1...v0.6.2

go-envconfig - v0.6.1

Published by sethvargo over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/sethvargo/go-envconfig/compare/v0.6.0...v0.6.1

go-envconfig -

Published by sethvargo over 2 years ago

Features

  • Add support for custom element delimiters for slices and maps
  • Add support for custom key/value separators for maps