From: Sergey Matveev <stargrave@stargrave.org>
Date: Sun, 29 Jan 2023 09:25:31 +0000 (+0300)
Subject: Ability to override fifos/
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=refs%2Fheads%2Fbtrtrc-old;p=btrtrc.git

Ability to override fifos/
---

diff --git a/cmd/btrtrc/fifos.go b/cmd/btrtrc/fifos.go
index 0167b734..c723be04 100644
--- a/cmd/btrtrc/fifos.go
+++ b/cmd/btrtrc/fifos.go
@@ -25,7 +25,6 @@ import (
 
 const (
 	MaxListNameWidth = 40
-	FIFOsDir         = "fifos"
 	PeersDir         = "peers"
 	FilesDir         = "files"
 )
@@ -37,6 +36,7 @@ type TorrentStat struct {
 }
 
 var (
+	FIFOsDir      = "fifos"
 	TorrentStats  = map[metainfo.Hash]TorrentStat{}
 	TorrentStatsM sync.RWMutex
 	Torrents      []metainfo.Hash
diff --git a/cmd/btrtrc/main.go b/cmd/btrtrc/main.go
index 63e6c4ff..96d9c3fb 100644
--- a/cmd/btrtrc/main.go
+++ b/cmd/btrtrc/main.go
@@ -26,6 +26,7 @@ var (
 
 func main() {
 	log.SetFlags(log.Ldate | log.Ltime)
+	fifosDir := flag.String("fifos", "fifos", "Path to fifos/")
 	dhtBoot := flag.String("dht", "dht.cypherpunks.ru:8991", "Comma-separated list of DHT bootstrap nodes")
 	addr := flag.String("bind", "[::]:6881", "Address to bind to")
 	pub4 := flag.String("4", "", "External IPv4 address")
@@ -35,6 +36,7 @@ func main() {
 	verify := flag.Bool("verify", false, "Force verification of provided torrents")
 	flag.Parse()
 
+	FIFOsDir = *fifosDir
 	dht.DefaultGlobalBootstrapHostPorts = strings.Split(*dhtBoot, ",")
 	cc := torrent.NewDefaultClientConfig()
 	cc.Debug = *debug