Simple environmental configuration.
Go to file
Stanislav Nikitin 3476411569
Initial commit.
2019-09-17 18:39:37 +05:00
.vscode Initial commit. 2019-09-17 18:39:37 +05:00
README.md Initial commit. 2019-09-17 18:39:37 +05:00
compose_tree.go Initial commit. 2019-09-17 18:39:37 +05:00
field.go Initial commit. 2019-09-17 18:39:37 +05:00
go.mod Initial commit. 2019-09-17 18:39:37 +05:00
go.sum Initial commit. 2019-09-17 18:39:37 +05:00
options.go Initial commit. 2019-09-17 18:39:37 +05:00
parse_env.go Initial commit. 2019-09-17 18:39:37 +05:00
parse_env_test.go Initial commit. 2019-09-17 18:39:37 +05:00
sec.go Initial commit. 2019-09-17 18:39:37 +05:00
sec_test.go Initial commit. 2019-09-17 18:39:37 +05:00

README.md

SEC. Take a break and configure your application with ease.

SEC stands for "Simple Environment Configuration" and provides really simple way to configure your application.

After googling around Go applications configuration management packages that able to take parameters from environment configuration I came to a conclusion that there is none packages that able to do everything I want and yet have readable and testable source code.

Key intentions to create SEC:

  • Parse configuration into structure with support of infinitely nested structures.
  • Works properly with interfaces.
  • No goto's.
  • 100% code coverage.
  • No external dependencies (only testify for tests).
  • Readable code and proper variables naming.
  • Debug mode

This list might be updated if new key intention arrives :).

SEC was written under impression from https://github.com/vrischmann/envconfig/.

Installation

Go modules and dep are supported. Other package managers might or might not work, MRs are welcome!

Usage

SEC is designed to be easy to use parser, so there is only one requirement - passed data should be a structure. You cannot do something like:

var Data string
sec.Parse(&Data, nil)

This will throw errors, as any type you'll pass, except for pointer to structure.

SEC is unable to parse embedded unexported things except structures due to inability to get embedded field's address. Embed only structures, please.

Debug

To get additional debug output set SEC_DEBUG environment variable to true. If invalid boolean value will be passed it'll output error about that.

Debug output uses standart log package. This may change in future.