Skip to content

Instantly share code, notes, and snippets.

@AliveDevil
Last active January 31, 2024 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AliveDevil/8043e4d3c53bea1d1b9937b672df86f3 to your computer and use it in GitHub Desktop.
Save AliveDevil/8043e4d3c53bea1d1b9937b672df86f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
SERVICE_NAME=${1?"Arg 1 should be set to the service name"}
WORKDIR=${2?"Arg 2 should be set to the workdir"}
WORKDIR=$(realpath "${WORKDIR:+${WORKDIR}/}")
ENV_FILE=".env.${SERVICE_NAME}"
ENV_PATH="${WORKDIR}/${ENV_FILE}"
set -a
[ -f "${ENV_PATH}" ] && . "${ENV_PATH}"
set +a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment