diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-04-22 14:01:29 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2025-04-22 14:01:29 -0400 |
| commit | 7cc8953b71b783c02e04692fe1a71efdacb2c981 (patch) | |
| tree | 8b813f5e8ca072cccfa42f4f220979e1fb8cef9c | |
| parent | ee9ae6a86567d695eea338402afd3016fd612ffe (diff) | |
| download | anubis-7cc8953b71b783c02e04692fe1a71efdacb2c981.tar.xz anubis-7cc8953b71b783c02e04692fe1a71efdacb2c981.zip | |
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.
| -rw-r--r-- | cmd/anubis/main.go | 6 |
1 files changed, 5 insertions, 1 deletions
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) |
