2022-09-21 21:29:44 +02:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"git.front.kjuulh.io/kjuulh/curre"
|
|
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/server"
|
|
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/serverdeps"
|
|
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/services/signer"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Start(ctx context.Context, logger *zap.Logger) (*serverdeps.ServerDeps, error) {
|
|
|
|
deps := serverdeps.NewServerDeps(logger)
|
|
|
|
|
2022-09-21 21:50:08 +02:00
|
|
|
readyChan := make(chan curre.ComponentsAreReady, 1)
|
|
|
|
|
2022-09-21 21:29:44 +02:00
|
|
|
err := curre.NewManager().
|
|
|
|
Register(
|
|
|
|
server.NewStorageServer(logger.With(zap.Namespace("storage")), deps),
|
|
|
|
).
|
|
|
|
Register(
|
|
|
|
signer.NewOpenPGPApp(deps.GetOpenPGP()),
|
|
|
|
).
|
2022-09-21 21:50:08 +02:00
|
|
|
RunNonBlocking(ctx, readyChan)
|
|
|
|
|
|
|
|
<-readyChan
|
2022-09-21 21:29:44 +02:00
|
|
|
|
|
|
|
return deps, err
|
|
|
|
}
|