summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-11-08 22:52:31 +0200
committerPaul Buetow <paul@buetow.org>2024-11-08 22:52:31 +0200
commit9b14c12e0ccd5c96dd9f17d1b20fe134308d2184 (patch)
treeff60a38c88686962a188ccabdbd4eda37e7e28f5
parent7a63e78baf3fe9f769ad4a0569baf8ca71363cfe (diff)
refactor
-rw-r--r--cmd/gos/main.go5
-rw-r--r--internal/config/args.go2
2 files changed, 3 insertions, 4 deletions
diff --git a/cmd/gos/main.go b/cmd/gos/main.go
index 774dd13..ee7aae7 100644
--- a/cmd/gos/main.go
+++ b/cmd/gos/main.go
@@ -19,11 +19,10 @@ func main() {
dry := flag.Bool("dry", false, "Dry run")
version := flag.Bool("version", false, "Display version")
gosDir := flag.String("gosDir", filepath.Join(os.Getenv("HOME"), ".gosdir"), "Gos' queue and DB directory")
+ cacheDir := flag.String("cacheDir", filepath.Join(*gosDir, "cache"), "Go's cache dir")
browser := flag.String("browser", "firefox", "OAuth2 browser")
secretsConfigPath := filepath.Join(os.Getenv("HOME"), ".config/gos/gosec.json")
secretsConfigPath = *flag.String("secretsConfig", secretsConfigPath, "Gos' secret config")
- cacheDir := filepath.Join(os.Getenv("HOME"), ".config/gos/cache")
- cacheDir = *flag.String("cacheDir", cacheDir, "Go's cache dir")
platforms := flag.String("platforms", "Mastodon:500,LinkedIn:1000", "Platforms enabled plus their post size limits")
target := flag.Int("target", 2, "How many posts per week are the target?")
minQueued := flag.Int("minQueued", 4, "Minimum of queued items until printing a warn message!")
@@ -47,7 +46,7 @@ func main() {
PauseDays: *pauseDays,
Lookback: time.Duration(*lookback) * time.Hour * 24,
SecretsConfigPath: secretsConfigPath,
- CacheDir: cacheDir,
+ CacheDir: *cacheDir,
Secrets: secrets,
OAuth2Browser: *browser,
}
diff --git a/internal/config/args.go b/internal/config/args.go
index 77c3850..8c9f767 100644
--- a/internal/config/args.go
+++ b/internal/config/args.go
@@ -13,6 +13,7 @@ var validPlatforms = []string{"mastodon", "linkedin"}
type Args struct {
GosDir string
+ CacheDir string
DryRun bool
Platforms map[string]int // Platform name and post size limits
Target int
@@ -20,7 +21,6 @@ type Args struct {
MaxDaysQueued int
PauseDays int
Lookback time.Duration
- CacheDir string
SecretsConfigPath string
Secrets Secrets
OAuth2Browser string