Refactor the configuration file and `Config` object
garciparedes opened this issue · 2 comments
garciparedes commented
- Implement
__getitem__onminos.common.MinosConfiginstance. - Add more test for configuration Environment and Parametrized Mappers
- Create
interfacessection inMinosConfigfile - Parameterize
minos.common.MinosPoolsizes - Set default values for
MinosConfigvariables - Add versioning strategy for
minos.common.MinosConfig
garciparedes commented
Here is an example of the current version:
service:
name: product
aggregate: src.aggregates.Product
injections:
http_connector: minos.plugins.aiohttp.AioHttpConnector
lock_pool: minos.common.PostgreSqlLockPool
postgresql_pool: minos.common.PostgreSqlPool
broker_publisher: minos.plugins.kafka.PostgreSqlQueuedKafkaBrokerPublisher
broker_subscriber_builder: minos.plugins.kafka.PostgreSqlQueuedKafkaBrokerSubscriberBuilder
broker_pool: minos.networks.BrokerClientPool
transaction_repository: minos.aggregate.PostgreSqlTransactionRepository
event_repository: minos.aggregate.PostgreSqlEventRepository
snapshot_repository: minos.aggregate.PostgreSqlSnapshotRepository
saga_manager: minos.saga.SagaManager
discovery: minos.networks.DiscoveryConnector
product_repository: src.ProductQueryRepository
services:
- minos.networks.BrokerHandlerPort
- minos.networks.HttpPort
- minos.networks.PeriodicTaskSchedulerPort
routers:
- minos.networks.BrokerRouter
- minos.networks.PeriodicRouter
- minos.networks.RestHttpRouter
middleware:
- minos.saga.transactional_command
services:
- minos.networks.SystemService
- minos.aggregate.TransactionService
- minos.aggregate.SnapshotService
- minos.saga.SagaService
- src.ProductCommandService
- src.ProductQueryService
rest:
host: 0.0.0.0
port: 8084
broker:
host: localhost
port: 9092
queue:
database: product_db
user: minos
password: min0s
host: localhost
port: 5432
records: 1000
retry: 2
repository:
database: product_db
user: minos
password: min0s
host: localhost
port: 5432
snapshot:
database: product_db
user: minos
password: min0s
host: localhost
port: 5432
saga:
storage:
path: "./product.lmdb"
discovery:
client: minos.plugins.minos_discovery.MinosDiscoveryClient
host: localhost
port: 5567garciparedes commented
Here is an example of the proposed refactoring:
version: 2
name: product
injections:
- src.ProductQueryRepository
serializer:
client: minos.plugins.avro.AvroSerializer
compressor: minos.common.ZlibByteCompressor
databases:
default:
client: minos.plugins.aiopg.PostgresClient
database: product_db
user: minos
password: min0s
host: localhost
port: 5432
saga:
client: minos.plugins.lmbb.LmdbClient
path: ./product.lmdb
query:
client: minos.plugins.aiopg.PostgresClient
database: product_query_db
user: minos
password: min0s
host: localhost
port: 5432
interfaces:
http:
port: minos.networks.BrokerPort
connector:
client: minos.plugins.aiohttp.AioHttpConnector
port: 8081
broker:
port: minos.networks.BrokerPort
common:
host: localhost
port: 9092
queue:
records: 1000
retry: 2
publisher:
client: minos.plugins.kafka.KafkaBrokerPublisher
queue: minos.clients.aiopg.PostgresBrokerPublisherQueue
subscriber:
client: minos.plugins.kafka.KafkaBrokerSubscriber
queue: minos.clients.aiopg.PostgresBrokerSubscriberQueue
idempotent: minos.clients.aiopg.PostgresBrokerPublisherDuplicateDetector
periodic:
port: minos.networks.PeriodicTaskPort
pools:
lock: minos.common.InMemoryLockPool
database: minos.common.DatabasePool
broker: minos.common.BrokerClientPool
discovery:
connector: minos.networks.DiscoveryConnector
client: minos.plugins.minos_discovery.MinosDiscoveryClient
host: localhost
port: 5567
saga:
manager: minos.saga.SagaManager
aggregate:
entities:
- src.Order
- src.OrderItem
repositories:
event: minos.aggregate.PostgreSqlEventRepository
snapshot: minos.aggregate.PostgreSqlSnapshotRepository
transaction: minos.aggregate.PostgreSqlTransactionRepository
routers:
- minos.networks.BrokerRouter
- minos.networks.PeriodicRouter
- minos.networks.RestHttpRouter
middleware:
- minos.saga.transactional_command
services:
- minos.networks.SystemService
- minos.networks.OpenApiService
- minos.networks.AsyncApiService
- minos.aggregate.TransactionService
- minos.aggregate.SnapshotService
- minos.saga.SagaService
- src.queries.ProductQueryService
- src.commands.ProductCommandService