Skip to content

Commit

Permalink
feat(castor): initializing transactorLayer type can fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat Losoponkul committed Sep 14, 2022
1 parent e588abd commit a66349d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,19 @@ object GrpcModule {
}

object RepoModule {
val transactorLayer: ULayer[Transactor[Task]] = ZLayer.succeed(
Transactor.fromDriverManager[Task](
"org.postgresql.Driver",
"jdbc:postgresql://localhost:5432/castor?user=postgres&password=postgres",
"postgres",
"postgres"
val transactorLayer: TaskLayer[Transactor[Task]] = ZLayer.fromZIO(
ZIO.attempt(
Transactor.fromDriverManager[Task](
"org.postgresql.Driver",
"jdbc:postgresql://localhost:5432/castor",
"postgres",
"postgres"
)
)
)

val didOperationRepoLayer: ULayer[DIDOperationRepository[Task]] = transactorLayer >>> JdbcDIDOperationRepository.layer
val didOperationRepoLayer: TaskLayer[DIDOperationRepository[Task]] =
transactorLayer >>> JdbcDIDOperationRepository.layer

val layers = didOperationRepoLayer
}
2 changes: 1 addition & 1 deletion castor/service/docker/docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
volumes:
- pg_data_castor_db:/var/lib/postgresql/data

# delay to ensure DB is up before apply migrations
# delay to ensure DB is up before applying migrations
db_init_delay:
image: alpine:3
command: sleep 5
Expand Down

0 comments on commit a66349d

Please sign in to comment.