codex-factory/scripts/utils/env-variable-value.sh
nugaon 0bce2ed485
feat: docker image builds (#2)
* feat: add cleanup script in favor of many build trials

* feat: create docker images from specific state of spawned bee clients

* chore: add generated Docker files to git

* refactor: remove individual Docker files and create one common

* feat: remove Dockerfile creation and simplify the script

* feat: update common dockerfile on build

* refactor: remove generated Dockerfile from git

* chore: add generated Dockerfile to gitignore

* chore: ignore Dockerfile

* feat: check whether system environment variable is defined

* feat: common variable handling, new bee.sh functionalities and params

* feat: blockchain docker image build script

* feat: environment script to start the created images

* docs: amend readme

* feat: add bee image prefix env variable and its handlings

* feat: env variable handling + image prefix handling

* docs: amend readme

* feat: docker image prune

* docs: amend readme

* chore: echo for sudo password

* chore: echo for sudo password

* fix: environment queen logging

* chore: remove commented out code

* refactor: use osx compatible local variable init

* refactor: use shell check extension and make the script osx compatible

* fix: stop blockchain container as well on interrupting

* fix: rule out commented lines from env checking

* refactor: remove unnecessary echo

* refactor: remove cat command from the .env grep

* refactor: add some quotes to variable references where is necessary
2021-04-29 14:20:43 +02:00

19 lines
367 B
Bash
Executable File

#!/bin/bash
echo_env_variable_value() {
REF=$(printenv $1)
# There were no global set
if [ -z "$REF" ] ; then
MY_PATH=$(dirname "$0")
ENV_PATH=$( cd "$MY_PATH/.." && pwd )
VALUE=$(grep "^$1=" "$ENV_PATH/.env" | cut -d= -f2)
VALUE=${VALUE//\"/}
VALUE=${VALUE//\'/}
echo "$VALUE"
else
echo "$REF"
fi
}
echo_env_variable_value $1