Skip to content

Commit

Permalink
Update README.md (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly authored Nov 5, 2023
1 parent bac56ae commit d02345d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# struct2env
Convert between go structures to environment variable and back (for structured config <-> shell env)
Convert between go structures to environment variables and back (for structured config <-> shell env)

There are many go packages that are doing environment to go struct config (for instance https://github.com/kelseyhightower/envconfig) but I didn't find one doing the inverse and we needed to set a bunch of environment variables for shell and other tools to get some configuration structured as JSON and Go object, so this was born. For symetry the reverse was also added (history of commit on https://github.com/fortio/dflag/pull/50/commits)

Expand Down Expand Up @@ -34,5 +34,6 @@ TST_INT_POINTER="199"

Using
```go
struct2env.ToShellWithPrefix("TST_", struct2env.StructToEnvVars(foo))
kv, errs := struct2env.StructToEnvVars(foo)
struct2env.ToShellWithPrefix("TST_", kv)
```

0 comments on commit d02345d

Please sign in to comment.