From 6ee6b253f15ee3d55a54624c1c9c5ffc7ef520c5 Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Wed, 14 Dec 2016 22:20:55 +0100 Subject: [PATCH 1/2] Build docker images for develop and tags --- .drone.yml | 17 +++++++++++++++++ .drone.yml.sig | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 0aab190..6e579a7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,3 +20,20 @@ pipeline: when: event: [ push ] branch: [ master ] + + docker: + image: plugins/docker + repo: metalmatze/transmission-exporter + tags: + - develop + when: + event: [ push ] + branch: [ develop ] + + docker: + image: plugins/docker + repo: metalmatze/transmission-exporter + tags: [ '${TAG}' ] + when: + event: [ tag ] + branch: [ refs/tags/* ] diff --git a/.drone.yml.sig b/.drone.yml.sig index 14e2d02..74f8cc0 100644 --- a/.drone.yml.sig +++ b/.drone.yml.sig @@ -1 +1 @@ -eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9nbwogIHBhdGg6IHNyYy9naXRodWIuY29tL21ldGFsbWF0emUvdHJhbnNtaXNzaW9uLWV4cG9ydGVyCgpwaXBlbGluZToKICBidWlsZDoKICAgIGltYWdlOiBnb2xhbmc6YWxwaW5lCiAgICBjb21tYW5kczoKICAgICAgLSBhcGsgYWRkIC1VIGdpdCBtYWtlCiAgICAgIC0gbWFrZSBmbXQKICAgICAgLSBtYWtlIHZldAogICAgICAtIG1ha2UgbGludAogICAgICAtIG1ha2UgYnVpbGQKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBtZXRhbG1hdHplL3RyYW5zbWlzc2lvbi1leHBvcnRlcgogICAgdGFnczoKICAgICAgLSBsYXRlc3QKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQogICAgICBicmFuY2g6IFsgbWFzdGVyIF0K.EvjQhswEji2LJOlEuV5uxgF39PI0jftrgYc7MpJp4F8 \ No newline at end of file +eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9nbwogIHBhdGg6IHNyYy9naXRodWIuY29tL21ldGFsbWF0emUvdHJhbnNtaXNzaW9uLWV4cG9ydGVyCgpwaXBlbGluZToKICBidWlsZDoKICAgIGltYWdlOiBnb2xhbmc6YWxwaW5lCiAgICBjb21tYW5kczoKICAgICAgLSBhcGsgYWRkIC1VIGdpdCBtYWtlCiAgICAgIC0gbWFrZSBmbXQKICAgICAgLSBtYWtlIHZldAogICAgICAtIG1ha2UgbGludAogICAgICAtIG1ha2UgYnVpbGQKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBtZXRhbG1hdHplL3RyYW5zbWlzc2lvbi1leHBvcnRlcgogICAgdGFnczoKICAgICAgLSBsYXRlc3QKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQogICAgICBicmFuY2g6IFsgbWFzdGVyIF0KCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBtZXRhbG1hdHplL3RyYW5zbWlzc2lvbi1leHBvcnRlcgogICAgdGFnczoKICAgICAgLSBkZXZlbG9wCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoIF0KICAgICAgYnJhbmNoOiBbIGRldmVsb3AgXQoKICBkb2NrZXI6CiAgICBpbWFnZTogcGx1Z2lucy9kb2NrZXIKICAgIHJlcG86IG1ldGFsbWF0emUvdHJhbnNtaXNzaW9uLWV4cG9ydGVyCiAgICB0YWdzOiBbICcke1RBR30nIF0KICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHRhZyBdCiAgICAgIGJyYW5jaDogWyByZWZzL3RhZ3MvKiBdCg.RcpjcT3Ky5llmu2eagvPekXH95FLGquudasY3Qr-un0 \ No newline at end of file From 0428d9eb7b9c98c48132dedbadad88f7159dad63 Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Wed, 14 Dec 2016 22:21:22 +0100 Subject: [PATCH 2/2] Actually implement BasicAuth for transmission --- cmd/transmission-exporter/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/transmission-exporter/main.go b/cmd/transmission-exporter/main.go index b424158..8543cbd 100644 --- a/cmd/transmission-exporter/main.go +++ b/cmd/transmission-exporter/main.go @@ -29,7 +29,15 @@ func main() { arg.MustParse(&c) - client := transmission.New(c.TransmissionAddr, nil) + var user *transmission.User + if c.TransmissionUsername != "" && c.TransmissionPassword != "" { + user = &transmission.User{ + Username: c.TransmissionUsername, + Password: c.TransmissionPassword, + } + } + + client := transmission.New(c.TransmissionAddr, user) prometheus.MustRegister(NewTorrentCollector(client))