Skip to content

Instantly share code, notes, and snippets.

@ipleten
Created July 18, 2019 21:09
Show Gist options
  • Save ipleten/49df66b9dba3cc87360c86e19b384e7c to your computer and use it in GitHub Desktop.
Save ipleten/49df66b9dba3cc87360c86e19b384e7c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
env='prod'
team='common'
svc='adm'
declare -A IDS
IDS=(
# prod
['prod']='1'
['prod/auth/flow']='2'
['prod/auth/account']='2'
['prod/common/adm']='3'
# staging
['staging']='4'
)
# Magic is here.
ID=${IDS["${env}"]}
ID=${IDS["${env}/${team}"]:-${ID}}
ID=${IDS["${env}/${team}/${svc}"]:-${ID}}
echo "$ID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment