feat(gl): add immutable postgres ledger storage
This commit is contained in:
+13
-1
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"gl/application/health"
|
||||
"gl/infrastructure/config"
|
||||
"gl/infrastructure/postgres"
|
||||
grpcadapter "gl/interface/grpc"
|
||||
)
|
||||
|
||||
@@ -26,7 +27,18 @@ func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
handler := grpcadapter.NewHealthHandler(health.NewService(nil))
|
||||
database, err := postgres.Open(ctx, cfg.Database)
|
||||
if err != nil {
|
||||
slog.Error("open GL database", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer database.Close()
|
||||
if err := postgres.Migrate(ctx, database); err != nil {
|
||||
slog.Error("migrate GL database", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
handler := grpcadapter.NewHealthHandler(health.NewService(database))
|
||||
slog.Info("starting GL gRPC service", "host", cfg.GRPC.Host, "port", cfg.GRPC.Port)
|
||||
serverConfig := grpcadapter.ServerConfig{
|
||||
Host: cfg.GRPC.Host,
|
||||
|
||||
Reference in New Issue
Block a user