Skip to content

Commit

Permalink
add aws ses env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Sep 14, 2024
1 parent a760f17 commit 507157d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ jobs:
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
JWT_SECRET=${{ secrets.JWT_SECRET }}
JWT_EXPIRES_IN=${{ vars.JWT_EXPIRES_IN }}
AWS_SES_ACCESS_KEY_ID=${{ secrets.AWS_SES_ACCESS_KEY_ID }}
AWS_SES_ACCESS_KEY_SECRET=${{ secrets.AWS_SES_ACCESS_KEY_SECRET }}
AWS_SES_DOMAIN=${{ secrets.AWS_SES_DOMAIN }}
AWS_SES_REGION=${{ secrets.AWS_SES_REGION }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
8 changes: 8 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ARG DB_USERNAME
ARG DB_PASSWORD
ARG JWT_SECRET
ARG JWT_EXPIRES_IN
ARG AWS_SES_ACCESS_KEY_ID
ARG AWS_SES_ACCESS_KEY_SECRET
ARG AWS_SES_DOMAIN
ARG AWS_REGION

ENV DB_HOST $DB_HOST
ENV DB_PORT $DB_PORT
Expand All @@ -15,6 +19,10 @@ ENV DB_USERNAME $DB_USERNAME
ENV DB_PASSWORD $DB_PASSWORD
ENV JWT_SECRET $JWT_SECRET
ENV JWT_EXPIRES_IN $JWT_EXPIRES_IN
ENV AWS_SES_ACCESS_KEY_ID $AWS_SES_ACCESS_KEY_ID
ENV AWS_SES_ACCESS_KEY_SECRET $AWS_SES_ACCESS_KEY_SECRET
ENV AWS_SES_DOMAIN $AWS_SES_DOMAIN
ENV AWS_REGION $AWS_REGION


WORKDIR /app
Expand Down
6 changes: 6 additions & 0 deletions infrastructure/modules/env/api_env_vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ resource "random_password" "jwt_secret" {
override_special = "!#%&*()-_=+[]{}<>:?"
}

resource "aws_iam_access_key" "email_user_access_key" {
user = module.email.iam_user.name
}

locals {
api_secret_env_vars = {
Expand All @@ -14,6 +17,9 @@ locals {
DB_USERNAME = module.postgresql.username
DB_PORT = module.postgresql.port
JWT_SECRET = random_password.jwt_secret.result
AWS_SES_ACCESS_KEY_ID = aws_iam_access_key.email_user_access_key.id
AWS_SES_ACCESS_KEY_SECRET = aws_iam_access_key.email_user_access_key.secret
AWS_SES_DOMAIN = module.email.mail_from_domain
}
api_env_vars = {

Expand Down
5 changes: 4 additions & 1 deletion shared/config/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ DB_NAME=blc
DB_USERNAME=blue-carbon-cost
DB_PASSWORD=blue-carbon-cost
JWT_SECRET=mysecret
JWT_EXPIRES_IN=1d
JWT_EXPIRES_IN=1d
AWS_SES_ACCESS_KEY_ID=test
AWS_SES_ACCESS_KEY_SECRET=test
AWS_SES_DOMAIN=test

0 comments on commit 507157d

Please sign in to comment.