Fix snapshotProcessor initiation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2021-11-01 01:12:28 +01:00
parent d4dddc0df3
commit 801b082785
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -26,6 +26,25 @@ import (
"github.com/rosti-cz/node-api/node" "github.com/rosti-cz/node-api/node"
) )
var snapshotProcessor apps.SnapshotProcessor
func init() {
// Prepare snapshot processor
snapshotProcessor = apps.SnapshotProcessor{
AppsPath: config.AppsPath,
TmpSnapshotPath: config.SnapshotsPath,
IndexLabel: config.SnapshotsIndexLabel,
Driver: drivers.S3Driver{
S3AccessKey: config.SnapshotsS3AccessKey,
S3SecretKey: config.SnapshotsS3SecretKey,
S3Endpoint: config.SnapshotsS3Endpoint,
S3SSL: config.SnapshotsS3SSL,
Bucket: config.SnapshotsS3Bucket,
},
}
}
// This handler only passes messages to another function for easier testing // This handler only passes messages to another function for easier testing
func messageHandler(msg *nats.Msg) { func messageHandler(msg *nats.Msg) {
go _messageHandler(msg) go _messageHandler(msg)
@ -88,21 +107,6 @@ func _messageHandler(m *nats.Msg) error {
return nil return nil
} }
// Prepare snapshot processor
var snapshotProcessor apps.SnapshotProcessor = apps.SnapshotProcessor{
AppsPath: config.AppsPath,
TmpSnapshotPath: config.SnapshotsPath,
IndexLabel: config.SnapshotsIndexLabel,
Driver: drivers.S3Driver{
S3AccessKey: config.SnapshotsS3AccessKey,
S3SecretKey: config.SnapshotsS3SecretKey,
S3Endpoint: config.SnapshotsS3Endpoint,
S3SSL: config.SnapshotsS3SSL,
Bucket: config.SnapshotsS3Bucket,
},
}
// Returns list of apps // Returns list of apps
func listEventHandler(m *nats.Msg, message *RequestMessage) error { func listEventHandler(m *nats.Msg, message *RequestMessage) error {
log.Println("> List") log.Println("> List")