From 5c247b6f2907e8c4da5a66fa2192fcba95e100f2 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 5 May 2022 20:17:59 -0600 Subject: Refactor cfg to use envvars as well --- srv/cmd/mailinglist-cli/main.go | 6 +++++- srv/cmd/mediocre-blog/main.go | 5 ++++- srv/cmd/userid-calc-cli/main.go | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'srv/cmd') diff --git a/srv/cmd/mailinglist-cli/main.go b/srv/cmd/mailinglist-cli/main.go index 80fde25..a44dadd 100644 --- a/srv/cmd/mailinglist-cli/main.go +++ b/srv/cmd/mailinglist-cli/main.go @@ -14,8 +14,12 @@ import ( ) func main() { + ctx := context.Background() - cfg := cfg.New() + + cfg := cfg.New(cfg.Params{ + EnvPrefix: "MEDIOCRE_BLOG", + }) dataDir := cfg.String("data-dir", ".", "Directory to use for long term storage") diff --git a/srv/cmd/mediocre-blog/main.go b/srv/cmd/mediocre-blog/main.go index 9ac1401..7ff3743 100644 --- a/srv/cmd/mediocre-blog/main.go +++ b/srv/cmd/mediocre-blog/main.go @@ -22,7 +22,10 @@ import ( func main() { ctx := context.Background() - cfg := cfg.New() + + cfg := cfg.New(cfg.Params{ + EnvPrefix: "MEDIOCRE_BLOG", + }) dataDir := cfg.String("data-dir", ".", "Directory to use for long term storage") diff --git a/srv/cmd/userid-calc-cli/main.go b/srv/cmd/userid-calc-cli/main.go index c86ae5d..90c44e7 100644 --- a/srv/cmd/userid-calc-cli/main.go +++ b/srv/cmd/userid-calc-cli/main.go @@ -13,6 +13,7 @@ func main() { secret := flag.String("secret", "", "Secret to use when calculating UserIDs") name := flag.String("name", "", "") password := flag.String("password", "", "") + flag.Parse() calc := chat.NewUserIDCalculator([]byte(*secret)) -- cgit v1.2.3