Add README with install and logging docs
This commit is contained in:
76
README.md
Normal file
76
README.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# reforger_utils
|
||||||
|
|
||||||
|
Utilities for downloading and processing Arma Reforger workshop content.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
This module is hosted on a private Gitea instance.
|
||||||
|
|
||||||
|
Set private module settings once:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
go env -w GOPRIVATE=gitea.tbdevent.eu
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install a version:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
go get gitea.tbdevent.eu/ilbinek/reforger_utils@v0.0.15
|
||||||
|
```
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Download asset metadata and manifests from BI APIs.
|
||||||
|
- Download and rebuild fragmented files.
|
||||||
|
- Parse PAK file entries.
|
||||||
|
- Optional SOCKS5/Tor support for HTTP requests.
|
||||||
|
|
||||||
|
## Basic Usage
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"gitea.tbdevent.eu/ilbinek/reforger_utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
assets, err := reforger_utils.DoAssetsRequest("BADC0DEDABBEDA5E", "0.12.4573")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("found %d assets\n", len(assets))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Logging
|
||||||
|
|
||||||
|
The library uses structured slog logging and writes JSON logs to stdout by default.
|
||||||
|
This is container-friendly (including Dokploy) because logs are newline-based and do not overwrite previous output.
|
||||||
|
|
||||||
|
You can inject your own logger:
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"gitea.tbdevent.eu/ilbinek/reforger_utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo}))
|
||||||
|
reforger_utils.SetLogger(logger)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
go test ./...
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user