CLI flag for config file, rename config file to beretta.json

This commit is contained in:
Imbus 2025-06-24 09:42:51 +02:00
parent adb3ac5c9e
commit 4582c60fe3
2 changed files with 8 additions and 1 deletions

View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"flag"
"log" "log"
"math/rand" "math/rand"
"time" "time"
@ -40,8 +41,14 @@ func repoThread(c chan RepoUpdate, repo Repo, avgInterval int, db Db) {
} }
func main() { func main() {
conf := flag.String("config", "./beretta.json", "The path to the config file")
flag.Parse()
log.Printf("Using config path: %s", *conf)
// Load configuration // Load configuration
config, err := loadConfig("config.json") config, err := loadConfig(*conf)
if err != nil { if err != nil {
log.Fatalf("Failed to load configuration: %v", err) log.Fatalf("Failed to load configuration: %v", err)
} }