Skip to content

Commit

Permalink
Modify sed flag based on OS. Closes #1474.
Browse files Browse the repository at this point in the history
Co-authored-by: Holden Moreland <[email protected]>
  • Loading branch information
knadh and hdmoreland committed Aug 27, 2023
1 parent 25513b8 commit e317f2c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions install-prod.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RED="$(tput setaf 1 2>/dev/null || printf '')"
BLUE="$(tput setaf 4 2>/dev/null || printf '')"
GREEN="$(tput setaf 2 2>/dev/null || printf '')"
NO_COLOR="$(tput sgr0 2>/dev/null || printf '')"
SED_INPLACE=$(if [[ "$(uname)" == "Darwin" ]]; then echo "-i ''"; else echo "-i"; fi)

info() {
printf '%s\n' "${BLUE}> ${NO_COLOR} $*"
Expand Down Expand Up @@ -96,15 +97,15 @@ modify_config(){

info "modifying config.toml"
# Replace `db.host=localhost` with `db.host=db` in config file.
sed -i "s/host = \"localhost\"/host = \"listmonk_db\"/g" config.toml
sed $SED_INPLACE "s/host = \"localhost\"/host = \"listmonk_db\"/g" config.toml
# Replace `db.password=listmonk` with `db.password={{db_password}}` in config file.
# Note that `password` is wrapped with `\b`. This ensures that `admin_password` doesn't match this pattern instead.
sed -i "s/\bpassword\b = \"listmonk\"/password = \"$db_password\"/g" config.toml
sed $SED_INPLACE "s/\bpassword\b = \"listmonk\"/password = \"$db_password\"/g" config.toml
# Replace `app.address=localhost:9000` with `app.address=0.0.0.0:9000` in config file.
sed -i "s/address = \"localhost:9000\"/address = \"0.0.0.0:9000\"/g" config.toml
sed $SED_INPLACE "s/address = \"localhost:9000\"/address = \"0.0.0.0:9000\"/g" config.toml

info "modifying docker-compose.yml"
sed -i "s/POSTGRES_PASSWORD=listmonk/POSTGRES_PASSWORD=$db_password/g" docker-compose.yml
sed $SED_INPLACE "s/POSTGRES_PASSWORD=listmonk/POSTGRES_PASSWORD=$db_password/g" docker-compose.yml
}

run_migrations(){
Expand Down

0 comments on commit e317f2c

Please sign in to comment.