From 7cc8953b71b783c02e04692fe1a71efdacb2c981 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Tue, 22 Apr 2025 14:01:29 -0400 Subject: fix(cmd/anubis): extract bot policies with --extract-resources This allows a user that doesn't have anything but the Anubis binary to figure out what the default configuration does. --- cmd/anubis/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go index 222e21f..10e5084 100644 --- a/cmd/anubis/main.go +++ b/cmd/anubis/main.go @@ -27,6 +27,7 @@ import ( "time" "github.com/TecharoHQ/anubis" + "github.com/TecharoHQ/anubis/data" "github.com/TecharoHQ/anubis/internal" libanubis "github.com/TecharoHQ/anubis/lib" botPolicy "github.com/TecharoHQ/anubis/lib/policy" @@ -181,6 +182,9 @@ func main() { } if *extractResources != "" { + if err := extractEmbedFS(data.BotPolicies, ".", *extractResources); err != nil { + log.Fatal(err) + } if err := extractEmbedFS(web.Static, "static", *extractResources); err != nil { log.Fatal(err) } @@ -343,7 +347,7 @@ func extractEmbedFS(fsys embed.FS, root string, destDir string) error { return err } - destPath := filepath.Join(destDir, relPath) + destPath := filepath.Join(destDir, root, relPath) if d.IsDir() { return os.MkdirAll(destPath, 0o700) -- cgit v1.2.3