Skip to content

Commit

Permalink
Merge pull request #574 from alphagov/PP-6085-env-map
Browse files Browse the repository at this point in the history
PP-6085: Use env-map buildpack to set env vars
  • Loading branch information
richardTowers authored Feb 6, 2020
2 parents c2c3963 + 30f8029 commit 5d37db3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
43 changes: 26 additions & 17 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,40 @@
applications:
- name: ledger
buildpacks:
- https://github.com/alphagov/env-map-buildpack.git#v2
- java_buildpack
path: target/pay-ledger-0.1-SNAPSHOT-allinone.jar
health-check-type: http
health-check-http-endpoint: '/healthcheck'
health-check-invocation-timeout: 5
memory: ((memory))
disk_quota: ((disk_quota))
services:
- ledger-db
- sqs
env:
ENV_MAP_BP_USE_APP_PROFILE_DIR: true

# Provided by the ledger-db service - see src/main/resources/env-map.yml
DB_HOST: ''
DB_NAME: ''
DB_PASSWORD: ''
DB_USER: ''
DB_SSL_OPTION: ''

# Provided by the sqs service - see src/main/resources/env-map.yml
AWS_SQS_ENDPOINT: ''
AWS_SQS_PAYMENT_EVENT_QUEUE_URL: ''

# Other sqs settings
AWS_ACCESS_KEY: ((aws_access_key))
AWS_SECRET_KEY: ((aws_secret_key))
AWS_SQS_MESSAGE_MAXIMUM_WAIT_TIME_IN_SECONDS: '20'
QUEUE_MESSAGE_RECEIVER_THREAD_DELAY_IN_MILLISECONDS: '1000'
AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT: 'true'
AWS_SQS_REGION: region-1


ADMIN_PORT: '10701'
DISABLE_INTERNAL_HTTPS: ((disable_internal_https))
ENVIRONMENT: ((space))
Expand All @@ -19,25 +45,8 @@ applications:
JPA_LOG_LEVEL: 'INFO'
JPA_SQL_LOG_LEVEL: 'INFO'

# Provide via ledger-db service
DB_HOST: postgres-((space)).apps.internal
DB_NAME: ((db_name))
DB_PASSWORD: ((db_password))
DB_USER: ((db_user))
DB_SSL_OPTION: ((db_ssl_option))

AWS_XRAY_CONTEXT_MISSING: LOG_ERROR

# Provide via aws-sqs service
AWS_ACCESS_KEY: ((aws_access_key))
AWS_SECRET_KEY: ((aws_secret_key))
AWS_SQS_ENDPOINT: http://sqs-((space)).apps.internal:9324
AWS_SQS_MESSAGE_MAXIMUM_WAIT_TIME_IN_SECONDS: '20'
QUEUE_MESSAGE_RECEIVER_THREAD_DELAY_IN_MILLISECONDS: '1000'
AWS_SQS_NON_STANDARD_SERVICE_ENDPOINT: 'true'
AWS_SQS_PAYMENT_EVENT_QUEUE_URL: http://sqs-((space)).apps.internal:9324/queue/pay_event_queue
AWS_SQS_REGION: region-1

# Provide via Sentry service
SENTRY_DSN: noop://localhost

Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/env-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
env_vars:
DB_HOST: '.[][] | select(.name == "ledger-db") | .credentials.host '
DB_NAME: '.[][] | select(.name == "ledger-db") | .credentials.name '
DB_PASSWORD: '.[][] | select(.name == "ledger-db") | .credentials.password '
DB_USER: '.[][] | select(.name == "ledger-db") | .credentials.username '
DB_SSL_OPTION: '.[][] | select(.name == "ledger-db") | .credentials.ssl_option // "ssl=true"'
AWS_SQS_ENDPOINT: '.[][] | select(.name == "sqs") | .credentials.endpoint '
AWS_SQS_PAYMENT_EVENT_QUEUE_URL: '.[][] | select(.name == "sqs") | .credentials.event_queue_url '

0 comments on commit 5d37db3

Please sign in to comment.