-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathenvironment
53 lines (44 loc) · 2.24 KB
/
environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Resolve the location of this file and set APP_HOME to the root
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
export APP_HOME="$(cd -P "$(dirname "$SOURCE")" && pwd)"
set -a
APP_NAME=dcpquery
STAGE="${DEPLOYMENT_STAGE:-${STAGE:-dev}}"
if [[ $STAGE == "prod" ]]; then
API_DOMAIN_NAME=query.data.humancellatlas.org
API_DNS_ZONE=data.humancellatlas.org.
DSS_HOST=dss.data.humancellatlas.org
else
API_DOMAIN_NAME=query.${STAGE}.data.humancellatlas.org
API_DNS_ZONE=${STAGE}.data.humancellatlas.org.
# Because dev and integration contain more volatile, less meaningful data, by default we point our test environments
# at the staging DSS deployment.
DSS_HOST=dss.staging.data.humancellatlas.org
fi
BUNDLE_EVENTS_QUEUE_NAME=${APP_NAME}-${STAGE}-bundle-events
ASYNC_QUERIES_QUEUE_NAME=${APP_NAME}-${STAGE}-async-queries
WEBHOOK_SECRET_NAME=${APP_NAME}/${STAGE}/webhook-auth-config
# Set DCPQUERY_DEBUG=0 to disable debugging and set the app log level to ERROR.
# Set DCPQUERY_DEBUG=1 to change the log level to INFO and cause stack traces to appear in error responses.
# Set DCPQUERY_DEBUG=2 to change the log level to DEBUG and cause stack traces to appear in error responses.
DCPQUERY_DEBUG=1
# This is set for build reproducibility
PYTHONHASHSEED=0
TF_DATA_DIR=.terraform.$STAGE
TFSTATE_FILE=${TF_DATA_DIR}/remote.tfstate
TF_CLI_ARGS_output="--state ${TFSTATE_FILE}"
TF_CLI_ARGS_init="--backend-config ${APP_HOME}/${TF_DATA_DIR}/aws_config.json"
# See https://github.com/terraform-providers/terraform-provider-aws/issues/1184
AWS_SDK_LOAD_CONFIG=1
if [[ -z "$AWS_DEFAULT_REGION" ]]; then
AWS_DEFAULT_REGION=$(aws configure get region)
fi
AWS_ACCOUNT_ID=$(aws sts get-caller-identity | jq -r .Account)
TF_S3_BUCKET=tfstate-$AWS_ACCOUNT_ID
SERVICE_S3_BUCKET="org-humancellatlas-$APP_NAME-$STAGE"
EXPORT_ENV_VARS_TO_TF="APP_NAME STAGE OWNER BUNDLE_EVENTS_QUEUE_NAME ASYNC_QUERIES_QUEUE_NAME WEBHOOK_SECRET_NAME API_DOMAIN_NAME API_DNS_ZONE AWS_ACCOUNT_ID SERVICE_S3_BUCKET DSS_HOST DCPQUERY_DEBUG"
EXPORT_ENV_VARS_TO_LAMBDA=$EXPORT_ENV_VARS_TO_TF
set +a
for v in $EXPORT_ENV_VARS_TO_TF; do echo "variable $v { default = \"${!v}\" }"; done > terraform/variables.tf