Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
johanix committed Sep 27, 2024
1 parent 0ffed7d commit 6060308
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22.3

require (
github.com/dnstapir/tapir v0.0.0-20240927111630-589bd474c6e4
github.com/google/uuid v1.4.0
github.com/gorilla/mux v1.8.1
github.com/lestrrat-go/jwx/v2 v2.0.21
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/gookit/goutil v0.6.16 h1:9fRMCF4X9abdRD5+2HhBS/GwafjBlTUBjRtA5dgkvuw=
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os/signal"
"syscall"

"github.com/google/uuid"
flag "github.com/spf13/pflag"

"github.com/dnstapir/tapir"
Expand All @@ -23,9 +24,14 @@ var TEMExiter = func(args ...interface{}) {
os.Exit(1)
}

var mqttclientid string

func main() {
mqttclientid = "tapir-slogger-" + uuid.New().String()
flag.BoolVarP(&tapir.GlobalCF.Debug, "debug", "d", false, "Debug mode")
flag.BoolVarP(&tapir.GlobalCF.Verbose, "verbose", "v", false, "Verbose mode")
flag.StringVarP(&mqttclientid, "client-id", "", mqttclientid, "MQTT client id, default is a random string")

flag.Parse()

var cfgFile string
Expand Down Expand Up @@ -54,7 +60,7 @@ func main() {
// Initialize logger
logger := NewLogger(config.LogConfig.File)

meng, err := tapir.NewMqttEngine("tapir-slogger", config.TapirConfig.MqttConfig.ClientID, tapir.TapirSub, nil, log.Default())
meng, err := tapir.NewMqttEngine("tapir-slogger", mqttclientid, tapir.TapirSub, nil, log.Default())
if err != nil {
log.Fatalf("Error initializing MQTT engine: %v", err)
}
Expand Down
27 changes: 27 additions & 0 deletions slogger.sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiserver:
addresses: [ ":8080" ]
tlsaddresses: [ ":8081" ]

tapir:
mqtt:
server: tls://mqtt.dev.dnstapir.se:8883
qos: 1
clientcert: /etc/dnstapir/certs/mqttclient.crt
clientkey: /etc/dnstapir/certs/mqttclient-key.pem
cacert: /etc/dnstapir/certs/tapirCA.crt

status:
topic: status/up/axfr/tapir-pop
validatorkey: /etc/dnstapir/certs/mqttsigner-pub.pem

keyupload:
topic: pubkey/up/#

certs:
cacertfile: /etc/dnstapir/certs/tapirCA.crt
tapir-slogger:
cert: /etc/dnstapir/certs/mqttclient.crt
key: /etc/dnstapir/certs/mqttclient-key.pem

log:
file: /var/log/dnstapir/tapir-slogger.log

0 comments on commit 6060308

Please sign in to comment.