Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prd / test / dev serverless config #9101

Draft
wants to merge 1 commit into
base: chore/vuln-deps-jira
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/jira/functions/config/serverless-env.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
frontendUrl: https://app.jira-test.ctfapps.net
oauthRedirectUri: https://api.jira-test.ctfapps.net/auth
baseUrl: https://api.jira-test.ctfapps.net
domainName: api.jira-test.ctfapps.net
4 changes: 4 additions & 0 deletions apps/jira/functions/config/serverless-env.prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
frontendUrl: https://app.jira.ctfapps.net
oauthRedirectUri: https://api.jira.ctfapps.net/auth
baseUrl: https://api.jira.ctfapps.net
domainName: api.jira.ctfapps.net
4 changes: 4 additions & 0 deletions apps/jira/functions/config/serverless-env.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
frontendUrl: https://app.jira-test.ctfapps.net
oauthRedirectUri: https://api.jira-test.ctfapps.net/auth
baseUrl: https://api.jira-test.ctfapps.net
domainName: api.jira-test.ctfapps.net
2 changes: 1 addition & 1 deletion apps/jira/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "ts-mocha '**/*.spec.ts'",
"test:ci": "npm run test",
"deploy": "sls deploy --stage $STAGE",
"deploy:test": "npm run deploy",
"deploy:test": "NODE_ENV=test sls deploy --stage test",
"start": "npm run build && serverless offline --httpPort 3000"
},
"dependencies": {
Expand Down
26 changes: 10 additions & 16 deletions apps/jira/functions/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,20 @@ plugins:
custom:
myStage: ${opt:stage, self:provider.stage}
myEnvironment:
FRONTEND_URL:
prd: 'https://app.jira.ctfapps.net'
test: 'http://localhost:1234'
OAUTH_REDIRECT_URI:
prd: 'https://api.jira.ctfapps.net/auth'
test: '${env:NGROK_URL}/dev/auth'
BASE_URL:
prd: 'https://api.jira.ctfapps.net'
test: '${env:NGROK_URL}/dev'
FRONTEND_URL: ${file(./config/serverless-env.${self:custom.myStage}.yml):frontendUrl}
OAUTH_REDIRECT_URI: ${file(./config/serverless-env.${self:custom.myStage}.yml):oauthRedirectUri}
BASE_URL: ${file(./config/serverless-env.${self:custom.myStage}.yml):baseUrl}
customDomain:
domainName: api.jira.ctfapps.net
stage: prd
domainName: ${file(./config/serverless-env.${self:custom.myStage}.yml):domainName}
stage: ${self:custom.myStage}
createRoute53Record: true
endpointType: 'edge'
securityPolicy: tls_1_2

provider:
name: aws
runtime: nodejs16.x
stage: ${opt:stage, 'test'}
stage: ${opt:stage, 'dev'}
region: 'us-east-1'
deploymentBucket:
name: cf-apps-serverless-deployment
Expand All @@ -46,9 +40,9 @@ functions:
description: OAuth backend for Atlassian
role: arn:aws:iam::${env:AWS_ACCOUNT_ID}:role/atlassian_oauth_lambda
environment:
OAUTH_CREDENTIALS_SECRET_ID: apps/jira/${opt:stage, 'test'}/oauth-credentials
OAUTH_REDIRECT_URI: ${self:custom.myEnvironment.OAUTH_REDIRECT_URI.${self:custom.myStage}}
FRONTEND_URL: ${self:custom.myEnvironment.FRONTEND_URL.${self:custom.myStage}}
OAUTH_CREDENTIALS_SECRET_ID: apps/jira/${self:custom.myStage}/oauth-credentials
OAUTH_REDIRECT_URI: ${self:custom.myEnvironment.OAUTH_REDIRECT_URI}
FRONTEND_URL: ${self:custom.myEnvironment.FRONTEND_URL}
OAUTH_TOKEN_EXCHANGE_ENDPOINT: https://auth.atlassian.com/oauth/token
events:
- http:
Expand All @@ -61,7 +55,7 @@ functions:
description: connect.json for JIRA
role: arn:aws:iam::${env:AWS_ACCOUNT_ID}:role/jira_connect_lambda
environment:
BASE_URL: ${self:custom.myEnvironment.BASE_URL.${self:custom.myStage}}
BASE_URL: ${self:custom.myEnvironment.BASE_URL}
events:
- http:
path: connect.json
Expand Down