Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Modify `sed` flag based on OS. Closes #1474.

Kailash Nadhe317f2c5ff10
diff --git a/install-prod.sh b/install-prod.sh
old mode 100644
new mode 100755
index 0a37dae1..c5ec52e2
--- a/install-prod.sh
+++ b/install-prod.sh
@@ -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} $*"
@@ -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(){