mirror of
https://github.com/onedr0p/exportarr.git
synced 2026-02-06 10:57:32 +00:00
feat: add basic auth support for SABnzbd
This commit is contained in:
parent
e9a64ee311
commit
890cb875b1
@ -27,4 +27,4 @@ COPY --from=builder --chown=nonroot:nonroot /sbin/tini-static /tini
|
||||
ENTRYPOINT [ "/tini", "--", "/exportarr" ]
|
||||
LABEL \
|
||||
org.opencontainers.image.title="exportarr" \
|
||||
org.opencontainers.image.source="https://github.com/onedr0p/exportarr"
|
||||
org.opencontainers.image.source="https://github.com/shamelin/exportarr"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
AIO Prometheus Exporter for Sonarr, Radarr, Lidarr, Prowlarr, Readarr, Bazarr and Sabnzbd
|
||||
|
||||
[](https://goreportcard.com/report/github.com/onedr0p/exportarr)
|
||||
[](https://goreportcard.com/report/github.com/shamelin/exportarr)
|
||||
|
||||
Note: This exporter will not gather metrics from all apps at once. You will need an `exportarr` instance for each app. Be sure to see the examples below for more information.
|
||||
|
||||
@ -30,7 +30,7 @@ docker run --name exportarr_$app \
|
||||
-e APIKEY="$apikey" \
|
||||
--restart unless-stopped \
|
||||
-p 9707:9707 \
|
||||
-d ghcr.io/onedr0p/exportarr:latest $app
|
||||
-d ghcr.io/shamelin/exportarr:latest $app
|
||||
```
|
||||
|
||||
Visit http://127.0.0.1:9707/metrics to see the app metrics
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/onedr0p/exportarr/internal/commands"
|
||||
"github.com/shamelin/exportarr/internal/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
18
go.mod
18
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/onedr0p/exportarr
|
||||
module github.com/shamelin/exportarr
|
||||
|
||||
go 1.23.0
|
||||
|
||||
@ -16,7 +16,7 @@ require (
|
||||
github.com/spf13/pflag v1.0.6
|
||||
github.com/stretchr/testify v1.10.0
|
||||
go.uber.org/zap v1.27.0
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8
|
||||
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476
|
||||
golang.org/x/sync v0.15.0
|
||||
)
|
||||
|
||||
@ -35,12 +35,12 @@ require (
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
go.uber.org/multierr v1.10.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
google.golang.org/protobuf v1.36.5 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.64.0 // indirect
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
16
go.sum
16
go.sum
@ -53,10 +53,16 @@ github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/
|
||||
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
|
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
||||
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
||||
github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4=
|
||||
github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
|
||||
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
@ -72,20 +78,30 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc=
|
||||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4=
|
||||
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/client"
|
||||
)
|
||||
|
||||
type Client = client.Client
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
base_client "github.com/onedr0p/exportarr/internal/client"
|
||||
base_client "github.com/shamelin/exportarr/internal/client"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -2,13 +2,13 @@ package collector
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -5,10 +5,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -5,10 +5,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ package collector
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/client"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/arr/model"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/arr/client"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/model"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/onedr0p/exportarr/internal/test_util"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/test_util"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
"github.com/knadh/koanf/v2"
|
||||
flag "github.com/spf13/pflag"
|
||||
|
||||
base_config "github.com/onedr0p/exportarr/internal/config"
|
||||
base_config "github.com/shamelin/exportarr/internal/config"
|
||||
)
|
||||
|
||||
func RegisterArrFlags(flags *flag.FlagSet) {
|
||||
|
||||
@ -3,7 +3,7 @@ package config
|
||||
import (
|
||||
"testing"
|
||||
|
||||
base_config "github.com/onedr0p/exportarr/internal/config"
|
||||
base_config "github.com/shamelin/exportarr/internal/config"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -3,7 +3,7 @@ package config
|
||||
import (
|
||||
"testing"
|
||||
|
||||
base_config "github.com/onedr0p/exportarr/internal/config"
|
||||
base_config "github.com/shamelin/exportarr/internal/config"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/collector"
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/collector"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@ -3,8 +3,8 @@ package commands
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/arr/config"
|
||||
base_config "github.com/onedr0p/exportarr/internal/config"
|
||||
"github.com/shamelin/exportarr/internal/arr/config"
|
||||
base_config "github.com/shamelin/exportarr/internal/config"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -15,8 +15,8 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/config"
|
||||
"github.com/onedr0p/exportarr/internal/handlers"
|
||||
"github.com/shamelin/exportarr/internal/config"
|
||||
"github.com/shamelin/exportarr/internal/handlers"
|
||||
)
|
||||
|
||||
var GRACEFUL_TIMEOUT = 5 * time.Second
|
||||
@ -29,7 +29,7 @@ var (
|
||||
Short: "exportarr is a AIO Prometheus exporter for *arr applications",
|
||||
Long: `exportarr is a Prometheus exporter for *arr applications.
|
||||
It can export metrics from Radarr, Sonarr, Lidarr, Readarr, Bazarr and Prowlarr.
|
||||
More information available at the Github Repo (https://github.com/onedr0p/exportarr)`,
|
||||
More information available at the Github Repo (https://github.com/shamelin/exportarr)`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
conf.App = cmd.Name()
|
||||
},
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/collector"
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/config"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/collector"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/config"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ type Config struct {
|
||||
URL string `koanf:"url"`
|
||||
ApiKey string `koanf:"api-key"`
|
||||
ApiKeyFile string `koanf:"api-key-file"`
|
||||
AuthUsername string `koanf:"auth-username"`
|
||||
AuthPassword string `koanf:"auth-password"`
|
||||
Port int `koanf:"port" validate:"required"`
|
||||
Interface string `koanf:"interface" validate:"required|ip"`
|
||||
DisableSSLVerify bool `koanf:"disable-ssl-verify"`
|
||||
@ -123,6 +125,8 @@ func (c Config) Translates() map[string]string {
|
||||
"URL": "url",
|
||||
"ApiKey": "api-key",
|
||||
"ApiKeyFile": "api-key-file",
|
||||
"AuthUsername": "auth-username",
|
||||
"AuthPassword": "auth-password",
|
||||
"ApiVersion": "api-version",
|
||||
"Port": "port",
|
||||
"Interface": "interface",
|
||||
@ -130,6 +134,10 @@ func (c Config) Translates() map[string]string {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Config) UseBasicAuth() bool {
|
||||
return c.AuthUsername != "" && c.AuthPassword != ""
|
||||
}
|
||||
|
||||
// Remove in v2.0.0
|
||||
func backwardsCompatibilityTransforms(s string) string {
|
||||
switch s {
|
||||
|
||||
@ -2,12 +2,12 @@ package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/shamelin/exportarr/internal/config"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/config"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
@ -15,3 +15,19 @@ func (a ApiKeyAuth) Auth(req *http.Request) error {
|
||||
req.URL.RawQuery = q.Encode()
|
||||
return nil
|
||||
}
|
||||
|
||||
type BasicAuth struct {
|
||||
Username string
|
||||
Password string
|
||||
ApiKey string
|
||||
}
|
||||
|
||||
func (a *BasicAuth) Auth(req *http.Request) error {
|
||||
req.SetBasicAuth(a.Username, a.Password)
|
||||
if req.URL.Query().Get("apikey") == "" {
|
||||
q := req.URL.Query()
|
||||
q.Add("apikey", a.ApiKey)
|
||||
req.URL.RawQuery = q.Encode()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/model"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/model"
|
||||
)
|
||||
|
||||
type ServerStats interface {
|
||||
|
||||
@ -3,7 +3,7 @@ package collector
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/model"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -2,15 +2,15 @@ package collector
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/auth"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/client"
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/auth"
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/config"
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/model"
|
||||
"github.com/shamelin/exportarr/internal/client"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/config"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/model"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@ -173,8 +173,20 @@ type SabnzbdCollector struct {
|
||||
|
||||
// TODO: Add a sab-specific config struct to abstract away the config parsing
|
||||
func NewSabnzbdCollector(config *config.SabnzbdConfig) (*SabnzbdCollector, error) {
|
||||
auther := auth.ApiKeyAuth{ApiKey: config.ApiKey}
|
||||
client, err := client.NewClient(config.URL, config.DisableSSLVerify, auther)
|
||||
var authClient client.Authenticator
|
||||
if config.AuthUsername != "" && config.AuthPassword != "" {
|
||||
authClient = &auth.BasicAuth{
|
||||
Username: config.AuthUsername,
|
||||
Password: config.AuthPassword,
|
||||
ApiKey: config.ApiKey,
|
||||
}
|
||||
} else {
|
||||
authClient = &auth.ApiKeyAuth{
|
||||
ApiKey: config.ApiKey,
|
||||
}
|
||||
}
|
||||
|
||||
client, err := client.NewClient(config.URL, config.DisableSSLVerify, authClient)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to build client: %w", err)
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/onedr0p/exportarr/internal/sabnzbd/config"
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/shamelin/exportarr/internal/sabnzbd/config"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@ -2,12 +2,14 @@ package config
|
||||
|
||||
import (
|
||||
"github.com/gookit/validate"
|
||||
base_config "github.com/onedr0p/exportarr/internal/config"
|
||||
base_config "github.com/shamelin/exportarr/internal/config"
|
||||
)
|
||||
|
||||
type SabnzbdConfig struct {
|
||||
URL string `validate:"required|url"`
|
||||
ApiKey string `validate:"required"`
|
||||
AuthUsername string
|
||||
AuthPassword string
|
||||
DisableSSLVerify bool
|
||||
}
|
||||
|
||||
@ -15,6 +17,8 @@ func LoadSabnzbdConfig(conf base_config.Config) (*SabnzbdConfig, error) {
|
||||
ret := &SabnzbdConfig{
|
||||
URL: conf.URL,
|
||||
ApiKey: conf.ApiKey,
|
||||
AuthUsername: conf.AuthUsername,
|
||||
AuthPassword: conf.AuthPassword,
|
||||
DisableSSLVerify: conf.DisableSSLVerify,
|
||||
}
|
||||
return ret, nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user