Skip to content

Commit

Permalink
fix: add mongo uri variable; add rabbit uri variable; 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinezAvellan committed Jan 21, 2025
1 parent b49825d commit 5af9415
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
3 changes: 3 additions & 0 deletions components/audit/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SERVER_ADDRESS=:${SERVER_PORT}
LOG_LEVEL=debug

# MONGO DB
#MONGO_URI=mongodb+srv
MONGO_URI=mongodb
MONGO_HOST=midaz-mongodb
MONGO_NAME=audit
MONGO_USER=midaz
Expand All @@ -35,6 +37,7 @@ OTEL_EXPORTER_OTLP_ENDPOINT_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT}

# RABBITMQ
RABBITMQ_URI=amqp
RABBITMQ_HOST=midaz-rabbitmq
RABBITMQ_PORT_HOST=3003
RABBITMQ_PORT_AMPQ=3004
Expand Down
10 changes: 6 additions & 4 deletions components/audit/internal/bootstrap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ type Config struct {
CasdoorOrganizationName string `env:"CASDOOR_ORGANIZATION_NAME"`
CasdoorApplicationName string `env:"CASDOOR_APPLICATION_NAME"`
CasdoorModelName string `env:"CASDOOR_MODEL_NAME"`
MongoURI string `env:"MONGO_URI"`
MongoDBHost string `env:"MONGO_HOST"`
MongoDBName string `env:"MONGO_NAME"`
MongoDBUser string `env:"MONGO_USER"`
MongoDBPassword string `env:"MONGO_PASSWORD"`
MongoDBPort string `env:"MONGO_PORT"`
RabbitURI string `env:"RABBITMQ_URI"`
RabbitMQHost string `env:"RABBITMQ_HOST"`
RabbitMQPortHost string `env:"RABBITMQ_PORT_HOST"`
RabbitMQPortAMQP string `env:"RABBITMQ_PORT_AMPQ"`
Expand Down Expand Up @@ -79,8 +81,8 @@ func InitServers() *Service {
Logger: logger,
}

rabbitSource := fmt.Sprintf("amqp://%s:%s@%s:%s",
cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)
rabbitSource := fmt.Sprintf("%s://%s:%s@%s:%s",
cfg.RabbitURI, cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)

rabbitMQConnection := &mrabbitmq.RabbitMQConnection{
ConnectionStringSource: rabbitSource,
Expand All @@ -98,8 +100,8 @@ func InitServers() *Service {
Logger: logger,
}

mongoSource := fmt.Sprintf("mongodb://%s:%s@%s:%s",
cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)
mongoSource := fmt.Sprintf("%s://%s:%s@%s:%s",
cfg.MongoURI, cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)

mongoAuditConnection := &mmongo.MongoConnection{
ConnectionStringSource: mongoSource,
Expand Down
3 changes: 3 additions & 0 deletions components/ledger/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DB_REPLICA_PASSWORD=lerian
DB_REPLICA_PORT=5702

# MONGO DB
#MONGO_URI=mongodb+srv
MONGO_URI=mongodb
MONGO_HOST=midaz-mongodb
MONGO_NAME=ledger
MONGO_USER=midaz
Expand Down Expand Up @@ -61,6 +63,7 @@ OTEL_EXPORTER_OTLP_ENDPOINT_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT}

# RABBITMQ
RABBITMQ_URI=amqp
RABBITMQ_HOST=midaz-rabbitmq
RABBITMQ_PORT_HOST=3003
RABBITMQ_PORT_AMPQ=3004
Expand Down
10 changes: 6 additions & 4 deletions components/ledger/internal/bootstrap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Config struct {
ReplicaDBPassword string `env:"DB_REPLICA_PASSWORD"`
ReplicaDBName string `env:"DB_REPLICA_NAME"`
ReplicaDBPort string `env:"DB_REPLICA_PORT"`
MongoURI string `env:"MONGO_URI"`
MongoDBHost string `env:"MONGO_HOST"`
MongoDBName string `env:"MONGO_NAME"`
MongoDBUser string `env:"MONGO_USER"`
Expand All @@ -56,6 +57,7 @@ type Config struct {
CasdoorApplicationName string `env:"CASDOOR_APPLICATION_NAME"`
CasdoorModelName string `env:"CASDOOR_MODEL_NAME"`
JWKAddress string `env:"CASDOOR_JWK_ADDRESS"`
RabbitURI string `env:"RABBITMQ_URI"`
RabbitMQHost string `env:"RABBITMQ_HOST"`
RabbitMQPortHost string `env:"RABBITMQ_PORT_HOST"`
RabbitMQPortAMQP string `env:"RABBITMQ_PORT_AMPQ"`
Expand Down Expand Up @@ -119,17 +121,17 @@ func InitServers() *Service {
Logger: logger,
}

mongoSource := fmt.Sprintf("mongodb://%s:%s@%s:%s",
cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)
mongoSource := fmt.Sprintf("%s://%s:%s@%s:%s",
cfg.MongoURI, cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)

mongoConnection := &mmongo.MongoConnection{
ConnectionStringSource: mongoSource,
Database: cfg.MongoDBName,
Logger: logger,
}

rabbitSource := fmt.Sprintf("amqp://%s:%s@%s:%s",
cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)
rabbitSource := fmt.Sprintf("%s://%s:%s@%s:%s",
cfg.RabbitURI, cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)

rabbitMQConnection := &mrabbitmq.RabbitMQConnection{
ConnectionStringSource: rabbitSource,
Expand Down
3 changes: 3 additions & 0 deletions components/transaction/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ DB_REPLICA_PASSWORD=lerian
DB_REPLICA_PORT=5702

# MONGO DB
#MONGO_URI=mongodb+srv
MONGO_URI=mongodb
MONGO_HOST=midaz-mongodb
MONGO_NAME=transaction
MONGO_USER=midaz
Expand Down Expand Up @@ -62,6 +64,7 @@ OTEL_EXPORTER_OTLP_ENDPOINT_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT}

# RABBITMQ
RABBITMQ_URI=amqp
RABBITMQ_HOST=midaz-rabbitmq
RABBITMQ_PORT_HOST=3003
RABBITMQ_PORT_AMPQ=3004
Expand Down
10 changes: 6 additions & 4 deletions components/transaction/internal/bootstrap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Config struct {
ReplicaDBPassword string `env:"DB_REPLICA_PASSWORD"`
ReplicaDBName string `env:"DB_REPLICA_NAME"`
ReplicaDBPort string `env:"DB_REPLICA_PORT"`
MongoURI string `env:"MONGO_URI"`
MongoDBHost string `env:"MONGO_HOST"`
MongoDBName string `env:"MONGO_NAME"`
MongoDBUser string `env:"MONGO_USER"`
Expand All @@ -55,6 +56,7 @@ type Config struct {
CasdoorApplicationName string `env:"CASDOOR_APPLICATION_NAME"`
CasdoorModelName string `env:"CASDOOR_MODEL_NAME"`
JWKAddress string `env:"CASDOOR_JWK_ADDRESS"`
RabbitURI string `env:"RABBITMQ_URI"`
RabbitMQHost string `env:"RABBITMQ_HOST"`
RabbitMQPortHost string `env:"RABBITMQ_PORT_HOST"`
RabbitMQPortAMQP string `env:"RABBITMQ_PORT_AMPQ"`
Expand Down Expand Up @@ -116,8 +118,8 @@ func InitServers() *Service {
Logger: logger,
}

mongoSource := fmt.Sprintf("mongodb://%s:%s@%s:%s/",
cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)
mongoSource := fmt.Sprintf("%s://%s:%s@%s:%s/",
cfg.MongoURI, cfg.MongoDBUser, cfg.MongoDBPassword, cfg.MongoDBHost, cfg.MongoDBPort)

mongoConnection := &mmongo.MongoConnection{
ConnectionStringSource: mongoSource,
Expand All @@ -132,8 +134,8 @@ func InitServers() *Service {
Logger: logger,
}

rabbitSource := fmt.Sprintf("amqp://%s:%s@%s:%s",
cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)
rabbitSource := fmt.Sprintf("%s://%s:%s@%s:%s",
cfg.RabbitURI, cfg.RabbitMQUser, cfg.RabbitMQPass, cfg.RabbitMQHost, cfg.RabbitMQPortHost)

rabbitMQConnection := &mrabbitmq.RabbitMQConnection{
ConnectionStringSource: rabbitSource,
Expand Down

0 comments on commit 5af9415

Please sign in to comment.