Skip to content

Commit

Permalink
fix: use awk to change public dir in env of the home fe repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 6, 2024
1 parent 01df71c commit 581eead
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ home_resource_env() {
# check and replace "PUBLIC_DIR=/Users/tanhongit/Data/CSlant/home-resource/public" to "PUBLIC_DIR=$HOME_RESOURCE_DIR/public"
if [ -f "$HOME_FE_DIR/.env" ] && ! grep -q "PUBLIC_DIR=$HOME_RESOURCE_DIR/public" "$HOME_FE_DIR/.env"; then
echo ' ∟ Setting up PUBLIC_DIR...'
sed -i '' "s|PUBLIC_DIR=.*|PUBLIC_DIR=$HOME_RESOURCE_DIR/public|g" "$HOME_FE_DIR/.env"
awk -v var="PUBLIC_DIR=$HOME_RESOURCE_DIR/public" 'BEGIN{FS=OFS="="} $1=="PUBLIC_DIR"{$2=var}1' "$HOME_FE_DIR/.env" > temp && mv temp "$HOME_FE_DIR/.env"
else
echo ' ∟ PUBLIC_DIR already set up...'
fi
Expand Down

0 comments on commit 581eead

Please sign in to comment.