diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fd71550cd027eb9c28d1367c484bf681b341b8c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,104 @@ +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/ + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Go template +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +### Helm template +# Chart dependencies +**/charts/*.tgz + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/charts/bbbatscale-support-notify/templates/NOTES.txt b/charts/bbbatscale-support-notify/templates/NOTES.txt index 08f703e53e221363818830b4024e3f490aea2cd9..c3228b1d519378ae4af309abee81c60be9ea857b 100644 --- a/charts/bbbatscale-support-notify/templates/NOTES.txt +++ b/charts/bbbatscale-support-notify/templates/NOTES.txt @@ -1,22 +1,2 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bbbatscale-support-notify.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "bbbatscale-support-notify.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bbbatscale-support-notify.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "bbbatscale-support-notify.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} +The application can be accessed within the cluster via: +{{ printf "http://%s.%s.svc.cluster.local%s/" (include "bbbatscale-support-notify.fullname" .) .Release.Namespace (ne .Values.service.port 80 | ternary (printf ":%d" .Values.service.port) "") }} diff --git a/charts/bbbatscale-support-notify/templates/_helpers.tpl b/charts/bbbatscale-support-notify/templates/_helpers.tpl index 71c6be7bf52c1548075d4e8106d04117de23b928..9aef01043bc2870eb80aa2f9c2972f51c6c4f597 100644 --- a/charts/bbbatscale-support-notify/templates/_helpers.tpl +++ b/charts/bbbatscale-support-notify/templates/_helpers.tpl @@ -62,14 +62,13 @@ Create the name of the service account to use {{- end }} {{- define "bbbatscale-support-notify.dockerConfig" -}} -auths: - {{- $auths := .auths }} - {{- range (keys $auths) }} - {{- $auth := get $auths . }} - {{ quote . }}: - username: {{ quote $auth.username }} - password: {{ quote $auth.password }} - auth: {{ printf "%s:%s" $auth.username $auth.password | b64enc }} - email: {{ get $auth "email" | quote }} - {{- end }} +{{- $mappedAuths := dict }} +{{- $auths := .auths }} + +{{- range (keys $auths) }} +{{- $auth := get $auths . }} +{{- $_ := set $mappedAuths . (dict "username" $auth.username "password" $auth.password "auth" (printf "%s:%s" $auth.username $auth.password | b64enc) "email" (get $auth "email")) }} +{{- end }} + +{{- dict "auths" $mappedAuths | mustToJson }} {{- end -}} diff --git a/charts/bbbatscale-support-notify/templates/deployment.yaml b/charts/bbbatscale-support-notify/templates/deployment.yaml index da565cde9004f2ce9f9cd30e614ecf04e59eae8e..e1fff945e3da56f512996e02a73cb946eb9bdad8 100644 --- a/charts/bbbatscale-support-notify/templates/deployment.yaml +++ b/charts/bbbatscale-support-notify/templates/deployment.yaml @@ -40,9 +40,6 @@ spec: envFrom: - secretRef: name: {{ include "bbbatscale-support-notify.fullname" . }} - env: - - name: NOTIFY_NOTLS - value: "1" ports: - name: http containerPort: 8080 diff --git a/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml b/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml index 3b35ec3b2a8b77ce11d787c0ef9e0eb4ef226bd8..8cfe6fa4ead4316f5728c5089078b615d485141a 100644 --- a/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml +++ b/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml @@ -1,3 +1,4 @@ +{{- if .Values.imagePullConfig }} apiVersion: v1 kind: Secret metadata: @@ -6,4 +7,5 @@ metadata: {{- include "bbbatscale-support-notify.labels" . | nindent 4 }} type: kubernetes.io/dockerconfigjson data: - .dockerconfigjson: {{ include "bbbatscale-support-notify.dockerConfig" .Values.imagePullConfig | fromYaml | toJson | b64enc }} + .dockerconfigjson: {{ include "bbbatscale-support-notify.dockerConfig" .Values.imagePullConfig | b64enc }} +{{- end }} diff --git a/charts/bbbatscale-support-notify/templates/ingress.yaml b/charts/bbbatscale-support-notify/templates/ingress.yaml deleted file mode 100644 index e2d838747eedbf911d6ebbf5b6bb4fdee7ab3db0..0000000000000000000000000000000000000000 --- a/charts/bbbatscale-support-notify/templates/ingress.yaml +++ /dev/null @@ -1,62 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "bbbatscale-support-notify.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if .Values.ingress.useRoute -}} -apiVersion: route.openshift.io/v1 -kind: Route -metadata: - name: {{ $fullName }} - labels: - {{- include "bbbatscale-support-notify.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - host: {{ (first .Values.ingress.hosts).host }} - tls: - termination: Reencrypt - insecureEdgeTerminationPolicy: Redirect - to: - kind: Service - name: {{ $fullName }} -{{- else -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "bbbatscale-support-notify.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end -}} diff --git a/charts/bbbatscale-support-notify/templates/service.yaml b/charts/bbbatscale-support-notify/templates/service.yaml index 3049699d80fd14ac15bae41aeae1c1abbf708b75..9a5a3ab55019b634925d1d729e9d579fbb147138 100644 --- a/charts/bbbatscale-support-notify/templates/service.yaml +++ b/charts/bbbatscale-support-notify/templates/service.yaml @@ -8,7 +8,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - targetPort: 8080 + targetPort: http protocol: TCP name: http selector: diff --git a/charts/bbbatscale-support-notify/values.yaml b/charts/bbbatscale-support-notify/values.yaml index b0977fdfa931dee6e2d31052a190b302f654f0db..51a6d0bf361877dfcf30d336d5bbeacf60e9a18a 100644 --- a/charts/bbbatscale-support-notify/values.yaml +++ b/charts/bbbatscale-support-notify/values.yaml @@ -16,8 +16,12 @@ imageStream: enabled: true periodicImports: true -imagePullSecrets: - - name: gitlab-registry +imagePullConfig: {} +# auths: +# registry.example.org: +# username: example-username +# password: secret-password +# email: optional-email@example.org matrixHomeserver: 'https://matrix.fbi.h-da.de' matrixUserId: '@rooms-support-notify:matrix.fbi.h-da.de' @@ -53,26 +57,6 @@ service: type: ClusterIP port: 80 -ingress: - enabled: true - - # Whether to use an OpenShft Route object instead of an Ingress. Specify - # false for non-OpenShift/OKD K8s deployments. BUG(ls): Path-specific routes - # are not yet supported for Routes, all requests for the specified hostname - # are routed to the Service. - useRoute: true - - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: rooms-support-notify.apps.ocp.fbi.h-da.de - paths: ['/'] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little diff --git a/go.sum b/go.sum index 1e2b5951a137b9fc3c4082bca770c93cb28f2690..78b5208d8bf4aec80e8f93e82bd6145c7997c7dd 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,23 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -19,6 +25,7 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= @@ -37,6 +44,7 @@ go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -59,14 +67,19 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= maunium.net/go/maulogger/v2 v2.1.1/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= maunium.net/go/mautrix v0.7.13 h1:qfnvLxvQafvLgHbdZF/+9qs9gyArYf8fUnzfQbjgQaU= diff --git a/main.go b/main.go index 1485d0752df7044fdfc8a9f5d4a5839225f68c8a..b23e8fc3c00fa272465533c4143aa71122f1ea99 100644 --- a/main.go +++ b/main.go @@ -24,14 +24,8 @@ var ( matrixRoomID = flag.String("roomid", os.Getenv("MATRIX_ROOMID"), "Matrix room ID") - laddr = flag.String("listen", - getEnvOrDefault("NOTIFY_LISTEN_ADDR", ":8443"), "listen for requests on this `addr`") - noTLS = flag.Bool("notls", os.Getenv("NOTIFY_NOTLS") != "", - "serve plain-text HTTP instead of HTTPS") - certFile = flag.String("cert", - os.Getenv("NOTIFY_CERT"), "X.509 certificate to present to clients (PEM-encoded)") - keyFile = flag.String("key", - os.Getenv("NOTIFY_KEY"), "private key matching configured cert") + listenAddress = flag.String("listen", + getEnvOrDefault("NOTIFY_LISTEN_ADDR", ":8080"), "listen for requests on this `addr`") hookSecret = flag.String("secret", os.Getenv("NOTIFY_HOOKSECRET"), "hex-encoded secret for authenticating webhooks") @@ -41,7 +35,7 @@ func main() { logger, err := zap.NewProduction() if err != nil { // Just tear it down already. - fmt.Fprintln(os.Stderr, err) + _, _ = fmt.Fprintln(os.Stderr, err) os.Exit(1) } zap.RedirectStdLog(logger) @@ -52,7 +46,7 @@ func main() { m, err := mautrix.NewClient(*matrixHomeserver, id.UserID(*matrixUserID), *matrixToken) if err != nil { - log.Fatalw("mautrix.NewClient returned with error", + log.Fatalw("matrix.NewClient returned with error", "err", err, "homeserver", *matrixHomeserver, "userid", *matrixUserID, @@ -90,18 +84,11 @@ func main() { }() http.Handle("/notify", handler) - if *noTLS { - err = http.ListenAndServe(*laddr, nil) - } else { - err = http.ListenAndServeTLS(*laddr, *certFile, *keyFile, nil) - } + err = http.ListenAndServe(*listenAddress, nil) if err != nil { log.Fatalw("ListenAndServe failed", "err", err, - "addr", *laddr, - "tls", !*noTLS, - "cert", *certFile, - "key", *keyFile, + "address", *listenAddress, ) }