chore: fmt
This commit is contained in:
18
README.md
18
README.md
@@ -1,6 +1,7 @@
|
|||||||
# yourconfig
|
# yourconfig
|
||||||
|
|
||||||
A dead-simple Go library for loading config structs from environment variables — with optional tagging and required enforcement.
|
A dead-simple Go library for loading config structs from environment variables —
|
||||||
|
with optional tagging and required enforcement.
|
||||||
|
|
||||||
## 📦 Install
|
## 📦 Install
|
||||||
|
|
||||||
@@ -42,8 +43,8 @@ func main() {
|
|||||||
|
|
||||||
You configure fields using the `conf` struct tag:
|
You configure fields using the `conf` struct tag:
|
||||||
|
|
||||||
* **Custom env name:** First item (e.g. `conf:"MY_ENV"`)
|
- **Custom env name:** First item (e.g. `conf:"MY_ENV"`)
|
||||||
* **Options:** `key:value` or flags (e.g. `required:true`, or just `required`)
|
- **Options:** `key:value` or flags (e.g. `required:true`, or just `required`)
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
@@ -65,14 +66,16 @@ SomeItem string `conf:"DIFFERENT_NAME,required"`
|
|||||||
|
|
||||||
// combine name and required (option)
|
// combine name and required (option)
|
||||||
SomeItem string `conf:"DIFFERENT_NAME,required:true"`
|
SomeItem string `conf:"DIFFERENT_NAME,required:true"`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## ❗ Required Fields
|
## ❗ Required Fields
|
||||||
|
|
||||||
If a field is marked `required` and the environment variable is **not set**, loading will return an error. Use `MustLoad[T]()` to panic on error, or `Load[T]() (T, error)` to handle it gracefully.
|
If a field is marked `required` and the environment variable is **not set**,
|
||||||
|
loading will return an error. Use `MustLoad[T]()` to panic on error, or
|
||||||
|
`Load[T]() (T, error)` to handle it gracefully.
|
||||||
|
|
||||||
Private (unexported) fields are ignored unless tagged — in which case they produce a `not settable` error, avoid setting `conf` on private items.
|
Private (unexported) fields are ignored unless tagged — in which case they
|
||||||
|
produce a `not settable` error, avoid setting `conf` on private items.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
@@ -86,4 +89,5 @@ go test ./...
|
|||||||
|
|
||||||
## Release
|
## Release
|
||||||
|
|
||||||
Releases are handled through cuddle-please a pr based release tool, simply merge the pr and a release will be cut
|
Releases are handled through cuddle-please a pr based release tool, simply merge
|
||||||
|
the pr and a release will be cut
|
||||||
|
Reference in New Issue
Block a user