😶🌫️
Shellで.envに書かれた設定をexportする
ただのメモ
export.sh
#!/bin/bash
for kv in $(cat $1 | grep -v -e '^#' | grep -v -e '^$')
do
export $kv
done
つかいかた
source ./export.sh <ENV_FILE>
source ./export.sh .env.dev
.env.dev
# sample variable
HOGE=1
FUGA=http://localhost:8080
run.sh
#!/bin/bash
source ./export.sh .env.dev
echo $HOGE
echo $FUGA
Discussion