Skip to content

Commit

Permalink
add NOTIFICATION_TRANSPORT variable to deployments scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rikukissa committed Jan 17, 2024
1 parent 8eb1ae3 commit c928408
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
env:
DOMAIN: ${{ vars.DOMAIN }}
REPLICAS: ${{ vars.REPLICAS }}
NOTIFICATION_TRANSPORT: ${{ vars.NOTIFICATION_TRANSPORT }}
SMTP_PORT: ${{ secrets.SMTP_PORT }}
SMTP_HOST: ${{ secrets.SMTP_HOST }}
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
env:
DOMAIN: ${{ vars.DOMAIN }}
REPLICAS: ${{ vars.REPLICAS }}
NOTIFICATION_TRANSPORT: ${{ vars.NOTIFICATION_TRANSPORT }}
SMTP_PORT: ${{ secrets.SMTP_PORT }}
SMTP_HOST: ${{ secrets.SMTP_HOST }}
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }}
Expand Down
12 changes: 10 additions & 2 deletions infrastructure/create-github-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { existsSync } = require('fs')
const { mkdirSync } = require('fs')

const args = minimist(process.argv.slice(2), {
string: ['environment', 'vpn-type'],
string: ['environment', 'vpn-type', 'notification-transport'],
boolean: ['sms-enabled', 'configure-vpn', 'dry-run', 'configure-backup'],
alias: {}
})
Expand Down Expand Up @@ -224,6 +224,13 @@ async function main() {
process.exit(1)
}

if (!['email', 'sms'].includes(args['notification-transport'])) {
console.error(
'Please specify a notification transport. It should be either "email" or "sms"'
)
process.exit(1)
}

const { key, key_id } = await getPublicKey(config.environment)
const repositoryId = await getRepositoryId(
config.github_repository.ORGANISATION,
Expand Down Expand Up @@ -301,7 +308,8 @@ async function main() {
...config.infrastructure,
...config.seeding,
...config.whitelist,
...backupVariables
...backupVariables,
NOTIFICATION_TRANSPORT: args['notification-transport']
}

const allSecretsKeys = Object.keys(SECRETS)
Expand Down

0 comments on commit c928408

Please sign in to comment.