Move DefaultUnixAdminPath to config package

We can drop the soju package import. This shrinks down sojuctl's
size significantly (18M to 3M).
This commit is contained in:
Simon Ser 2023-03-15 17:46:52 +01:00
parent 4ca8dfa37d
commit 4c8e955946
6 changed files with 11 additions and 7 deletions

View File

@ -13,7 +13,7 @@ config_path := $(SYSCONFDIR)/soju/config
admin_socket_path := $(RUNDIR)/soju/admin
goflags := $(GOFLAGS) -ldflags=" \
-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)' \
-X 'git.sr.ht/~emersion/soju.DefaultUnixAdminPath=$(admin_socket_path)'"
-X 'git.sr.ht/~emersion/soju/config.DefaultUnixAdminPath=$(admin_socket_path)'"
all: soju sojudb sojuctl doc/soju.1

View File

@ -214,7 +214,7 @@ func main() {
case "unix+admin":
path := u.Path
if path == "" {
path = soju.DefaultUnixAdminPath
path = config.DefaultUnixAdminPath
}
ln, err := net.Listen("unix", path)
if err != nil {

View File

@ -4,7 +4,6 @@ import (
"context"
"flag"
"fmt"
"git.sr.ht/~emersion/soju"
"gopkg.in/irc.v4"
"log"
"net"
@ -37,7 +36,7 @@ func run(ctx context.Context, cfg *config.Server, words []string) error {
if u.Path != "" {
path = u.Path
} else {
path = soju.DefaultUnixAdminPath
path = config.DefaultUnixAdminPath
}
break
}

View File

@ -11,7 +11,10 @@ import (
"git.sr.ht/~emersion/go-scfg"
)
var DefaultPath string
var (
DefaultPath string
DefaultUnixAdminPath = "/run/soju/admin"
)
type IPSet []*net.IPNet

View File

@ -516,3 +516,7 @@ character.
Maintained by Simon Ser <contact@emersion.fr>, who is assisted by other
open-source contributors. For more information about soju development, see
<https://sr.ht/~emersion/soju>.
# SEE ALSO
*sojuctl*(1)

View File

@ -26,8 +26,6 @@ import (
"git.sr.ht/~emersion/soju/identd"
)
var DefaultUnixAdminPath = "/run/soju/admin"
// TODO: make configurable
var retryConnectMinDelay = time.Minute
var retryConnectMaxDelay = 10 * time.Minute