feat: update ff and use new nested feature

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-07-20 19:31:52 -05:00
parent 3c3f671957
commit 78ef9fc49c
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
4 changed files with 17 additions and 17 deletions

View File

@ -9,14 +9,15 @@ Configure Invitea with a config, environment variables, or flags.
```yaml ```yaml
domain: http://localhost:8080 domain: http://localhost:8080
session-secret: honk session-secret: honk
gitea-client-key: <client-key> # OAuth2 app key gitea:
gitea-client-secret: <client-secret> # OAuth2 app secret client-key: <client-key> # OAuth2 app key
gitea-token: <admin token> # Used for creating the accounts client-secret: <client-secret> # OAuth2 app secret
gitea-url: https://git.jojodev.com token: <admin token> # Used for creating the accounts
url: https://git.jojodev.com
level: info level: info
``` ```
The CLI flags would match the key above and environment variables would match `INVITEA_<KEY>`. The CLI flags would match the key above (using `.` for any nested section) and environment variables would match `INVITEA_<KEY>`.
```sh ```sh
./invitea --domain http://localhost8080 --session-secret honk ./invitea --domain http://localhost8080 --session-secret honk

16
flag.go
View File

@ -20,19 +20,19 @@ var (
// Required // Required
domainFlag = fs.String("domain", "", "Domain Invitea is running on") domainFlag = fs.String("domain", "", "Domain Invitea is running on")
giteaURLFlag = fs.String("gitea-url", "", "Gitea URL") giteaURLFlag = fs.String("gitea.url", "", "Gitea URL")
giteaClientKeyFlag = fs.String("gitea-client-key", "", "Gitea OAuth2 Client Key") giteaClientKeyFlag = fs.String("gitea.client-key", "", "Gitea OAuth2 Client Key")
giteaClientSecretFlag = fs.String("gitea-client-secret", "", "Gitea OAuth2 Client Secret") giteaClientSecretFlag = fs.String("gitea.client-secret", "", "Gitea OAuth2 Client Secret")
giteaTokenFlag = fs.String("gitea-token", "", "Gitea admin token") giteaTokenFlag = fs.String("gitea.token", "", "Gitea admin token")
) )
func requiredFlags() error { func requiredFlags() error {
required := map[string]*string{ required := map[string]*string{
"domain": domainFlag, "domain": domainFlag,
"gitea-url": giteaURLFlag, "gitea.url": giteaURLFlag,
"gitea-client-key": giteaClientKeyFlag, "gitea.client-key": giteaClientKeyFlag,
"gitea-client-secret": giteaClientSecretFlag, "gitea.client-secret": giteaClientSecretFlag,
"gitea-token": giteaTokenFlag, "gitea.token": giteaTokenFlag,
} }
var unset []string var unset []string

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/gorilla/securecookie v1.1.1 github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.1.1 github.com/gorilla/sessions v1.1.1
github.com/markbates/goth v1.69.0 github.com/markbates/goth v1.69.0
github.com/peterbourgon/ff/v3 v3.1.2 github.com/peterbourgon/ff/v3 v3.4.0
github.com/rs/zerolog v1.26.1 github.com/rs/zerolog v1.26.1
modernc.org/sqlite v1.10.6 modernc.org/sqlite v1.10.6
) )

5
go.sum
View File

@ -910,13 +910,12 @@ github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuh
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/peterbourgon/ff/v3 v3.1.2 h1:0GNhbRhO9yHA4CC27ymskOsuRpmX0YQxwxM9UPiP6JM= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc=
github.com/peterbourgon/ff/v3 v3.1.2/go.mod h1:XNJLY8EIl6MjMVjBS4F0+G0LYoAqs0DTa4rmHHukKDE= github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ=
github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY=
github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=