Skip to content

Commit

Permalink
✨(scripts) handle multiple API instances
Browse files Browse the repository at this point in the history
Now that we will create accounts on different instances, we need to be
able to choose which instance we are targeting.
  • Loading branch information
jmaupetit committed Feb 7, 2025
1 parent 99d5905 commit 10a30ba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ set -euo pipefail

# Constants
declare BREVO_SMTP_EMAIL_ENDPOINT="https://api.brevo.com/v3/smtp/email"
declare SCALINGO_APP="${SCALINGO_APP:-qualicharge-api-staging}"
declare ENVIRONMENT="${ENVIRONMENT:-staging}"

if [ "${ENVIRONMENT}" = "production" ]; then
SCALINGO_APP="qualicharge-api"
fi

echo "Environment: ${ENVIRONMENT} - ${SCALINGO_APP}"

# Password generator
function generate_password() {
Expand All @@ -15,7 +22,7 @@ function generate_password() {
function qualicharge() {

scalingo \
--app qualicharge-api \
--app "${SCALINGO_APP}" \
--region osc-fr1 \
run --silent \
python -m qualicharge "$@"
Expand Down Expand Up @@ -98,6 +105,7 @@ function email_send_link() {
templateId: 1,
params:{
first_name: $firstname,
environment: $environment,
send_url: $url
}
}'
Expand All @@ -107,6 +115,7 @@ function email_send_link() {
jq -nc \
--arg email "${email}" \
--arg firstname "${firstname}" \
--arg environment "${ENVIRONMENT}" \
--arg url "${url}" \
-f <(echo "${tpl}")
)
Expand Down

0 comments on commit 10a30ba

Please sign in to comment.