Skip to content

Commit

Permalink
feat(src): remove mailgun
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Pino committed Jun 18, 2024
1 parent 0d73349 commit a8c7d6a
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 104 deletions.
5 changes: 0 additions & 5 deletions env/.test.env
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ THROTTLER_NAME=THROTTLER
THROTTLER_TTL=60000
THROTTLER_LIMIT=10

## MAILGUN
MAILGUN_API_KEY=5a7a101a34138a00e20683e3fcb07f23-7ecaf6b5-b7bae0b8
MAILGUN_USER_NAME=api
MAILGUN_FROM=LUPPA <[email protected]>
MAILGUN_EMAIL_DOMAIN=mg.wocex.io
9 changes: 1 addition & 8 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { JwtAuthGuard } from './common/guards/jwt-auth.guard';
import { APP_GUARD } from '@nestjs/core';
import { PersonaModule } from './modules/persona/persona.module';
import { MasterTablesModule } from './modules/master-tables/master-tables.module';
import mailgunConfig from './config/mailgun.config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LoanInformationModule } from './modules/loan-information/loan-information.module';
import { MortgageInformationModule } from './modules/mortgage-information/mortgage-information.module';
Expand Down Expand Up @@ -48,13 +47,7 @@ import { BridgeLoanModule } from './modules/bridge-loan/bridge-loan.module';
imports: [
ConfigModule.forRoot({
envFilePath: `./env/.${process.env.NODE_ENV}.env`,
load: [
serverConfig,
databaseConfig,
jwtConfig,
throttlerConfig,
mailgunConfig,
],
load: [serverConfig, databaseConfig, jwtConfig, throttlerConfig],
isGlobal: true,
}),
TypeOrmModule.forRootAsync({
Expand Down
4 changes: 2 additions & 2 deletions src/common/services/mail/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class MailService {
constructor(private configService: ConfigService) {
const mailgun = new Mailgun(FormData);
this.clientMailGun = mailgun.client({
username: this.configService.get<string>('mailgun.userName'),
key: this.configService.get<string>('mailgun.key'),
username: 'username', //this.configService.get<string>('mailgun.userName'),
key: 'key', //this.configService.get<string>('mailgun.key'),
});
}

Expand Down
8 changes: 0 additions & 8 deletions src/config/mailgun.config.ts

This file was deleted.

112 changes: 56 additions & 56 deletions terraform/fuap-backend/load_balancer.tf
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
# Load Balancer (ALB)
resource "aws_lb" "main" {
name = "fuap-app-dev-alb"
internal = false
load_balancer_type = "application"
security_groups = [
aws_security_group.lb.id,
]

subnet_mapping {
subnet_id = aws_subnet.public_a.id # Reemplaza con el ID de la subred pública donde se ubicará el ALB
}

subnet_mapping {
subnet_id = aws_subnet.public_b.id # Subred en AZ B
}

tags = {
Name = "fuap-app-dev-alb"
}
}

# Target Group
resource "aws_lb_target_group" "main" {
name = "fuap-app-dev-target-group"
port = 3000 # Puerto donde escucha tu aplicación (por ejemplo, NestJS)
protocol = "HTTP"
target_type = "ip"

vpc_id = aws_vpc.main.id # Reemplaza con el ID de tu VPC

health_check {
path = "/api/docs"
protocol = "HTTP"
timeout = 5
interval = 30
healthy_threshold = 2
unhealthy_threshold = 2
}

tags = {
Name = "fuap-app-dev-target-group"
}
}

# Listener
resource "aws_lb_listener" "main" {
load_balancer_arn = aws_lb.main.arn
port = "80"
protocol = "HTTP"

default_action {
type = "forward"
target_group_arn = aws_lb_target_group.main.arn
}
}
# # Load Balancer (ALB)
# resource "aws_lb" "main" {
# name = "fuap-app-dev-alb"
# internal = false
# load_balancer_type = "application"
# security_groups = [
# aws_security_group.lb.id,
# ]

# subnet_mapping {
# subnet_id = aws_subnet.public_a.id # Reemplaza con el ID de la subred pública donde se ubicará el ALB
# }

# subnet_mapping {
# subnet_id = aws_subnet.public_b.id # Subred en AZ B
# }

# tags = {
# Name = "fuap-app-dev-alb"
# }
# }

# # Target Group
# resource "aws_lb_target_group" "main" {
# name = "fuap-app-dev-target-group"
# port = 3000 # Puerto donde escucha tu aplicación (por ejemplo, NestJS)
# protocol = "HTTP"
# target_type = "ip"

# vpc_id = aws_vpc.main.id # Reemplaza con el ID de tu VPC

# health_check {
# path = "/api/docs"
# protocol = "HTTP"
# timeout = 5
# interval = 30
# healthy_threshold = 2
# unhealthy_threshold = 2
# }

# tags = {
# Name = "fuap-app-dev-target-group"
# }
# }

# # Listener
# resource "aws_lb_listener" "main" {
# load_balancer_arn = aws_lb.main.arn
# port = "80"
# protocol = "HTTP"

# default_action {
# type = "forward"
# target_group_arn = aws_lb_target_group.main.arn
# }
# }
48 changes: 24 additions & 24 deletions terraform/fuap-backend/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,30 @@ resource "aws_security_group" "rds" {
}
}

resource "aws_security_group" "lb" {
vpc_id = aws_vpc.main.id
tags = {
Name = "lb-sg"
}
# resource "aws_security_group" "lb" {
# vpc_id = aws_vpc.main.id
# tags = {
# Name = "lb-sg"
# }

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
# ingress {
# from_port = 80
# to_port = 80
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }

ingress {
from_port = 4433
to_port = 4433
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
# ingress {
# from_port = 4433
# to_port = 4433
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
# egress {
# from_port = 0
# to_port = 0
# protocol = "-1"
# cidr_blocks = ["0.0.0.0/0"]
# }
# }
1 change: 0 additions & 1 deletion terraform/fuap-backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ variable "db_engine" {
default = "postgres"
}


variable "db_username" {
description = "User developer"
type = string
Expand Down

0 comments on commit a8c7d6a

Please sign in to comment.