Change import path and update example in README
This commit is contained in:
parent
fe009f63d4
commit
87d326246a
2 changed files with 9 additions and 8 deletions
15
README.md
15
README.md
|
@ -4,12 +4,12 @@
|
|||
|
||||
---
|
||||
|
||||
[](https://pkg.go.dev/git.tdpain.net/pkg/cfger)
|
||||
[](https://pkg.go.dev/go.akpain.net/cfger)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
go get git.tdpain.net/pkg/cfger
|
||||
go get go.akpain.net/cfger
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
@ -18,7 +18,8 @@ go get git.tdpain.net/pkg/cfger
|
|||
package config
|
||||
|
||||
import (
|
||||
"git.tdpain.net/pkg/cfger"
|
||||
"cmp"
|
||||
"go.akpain.net/cfger"
|
||||
)
|
||||
|
||||
type HTTP struct {
|
||||
|
@ -43,13 +44,13 @@ func Load() (*Config, error) {
|
|||
}
|
||||
|
||||
conf := &Config{
|
||||
Debug: cl.Required("debug").AsBool(),
|
||||
Debug: cmp.Or(cl.Get("debug").AsBool(), cl.GetEnv("DEBUG").AsBool()),
|
||||
HTTP: &HTTP{
|
||||
Host: cl.WithDefault("http.host", "127.0.0.1").AsString(),
|
||||
Port: cl.WithDefault("http.port", 8080).AsInt(),
|
||||
Host: cl.Get("http.host").WithDefault("127.0.0.1").AsString(),
|
||||
Port: cl.Get("http.port").WithDefault(8080).AsInt(),
|
||||
},
|
||||
Database: &Database{
|
||||
DSN: cl.WithDefault("database.dsn", "website.db").AsString(),
|
||||
DSN: cl.Get("database.dsn").Required().AsString(),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module git.tdpain.net/pkg/cfger
|
||||
module go.akpain.net/cfger
|
||||
|
||||
go 1.18
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue