Fix of snapshotProcessor initiation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Second try
This commit is contained in:
parent
801b082785
commit
66476275e4
@ -20,31 +20,11 @@ import (
|
|||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rosti-cz/node-api/apps"
|
"github.com/rosti-cz/node-api/apps"
|
||||||
"github.com/rosti-cz/node-api/apps/drivers"
|
|
||||||
"github.com/rosti-cz/node-api/common"
|
"github.com/rosti-cz/node-api/common"
|
||||||
"github.com/rosti-cz/node-api/docker"
|
"github.com/rosti-cz/node-api/docker"
|
||||||
"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)
|
||||||
|
17
main.go
17
main.go
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/labstack/echo"
|
"github.com/labstack/echo"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
"github.com/rosti-cz/node-api/apps"
|
"github.com/rosti-cz/node-api/apps"
|
||||||
|
"github.com/rosti-cz/node-api/apps/drivers"
|
||||||
"github.com/rosti-cz/node-api/common"
|
"github.com/rosti-cz/node-api/common"
|
||||||
"github.com/rosti-cz/node-api/node"
|
"github.com/rosti-cz/node-api/node"
|
||||||
)
|
)
|
||||||
@ -17,6 +18,7 @@ const JSONIndent = " "
|
|||||||
|
|
||||||
var config common.Config
|
var config common.Config
|
||||||
var nc *nats.Conn
|
var nc *nats.Conn
|
||||||
|
var snapshotProcessor apps.SnapshotProcessor
|
||||||
|
|
||||||
func _init() {
|
func _init() {
|
||||||
var err error
|
var err error
|
||||||
@ -35,6 +37,21 @@ func _init() {
|
|||||||
DB: common.GetDBConnection(),
|
DB: common.GetDBConnection(),
|
||||||
}
|
}
|
||||||
processor.Init()
|
processor.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,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user