Skip to content

Commit 2edd3ec

Browse files
Fix whitespace inconsistency in install scripts
1 parent 7691fbd commit 2edd3ec

File tree

2 files changed

+55
-55
lines changed

2 files changed

+55
-55
lines changed

install-demo.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ check_dependencies() {
88
if ! command -v curl > /dev/null; then
99
echo "curl is not installed."
1010
exit 1
11-
fi
11+
fi
1212

1313
if ! command -v docker > /dev/null; then
1414
echo "docker is not installed."
1515
exit 1
16-
fi
16+
fi
1717

1818
if ! command -v docker-compose > /dev/null; then
1919
echo "docker-compose is not installed."
@@ -22,12 +22,12 @@ check_dependencies() {
2222
}
2323

2424
setup_containers() {
25-
curl -o docker-compose.yml https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml
26-
docker-compose up -d demo-db demo-app
25+
curl -o docker-compose.yml https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml
26+
docker-compose up -d demo-db demo-app
2727
}
2828

2929
show_output(){
30-
echo -e "\nListmonk is now up and running. Visit http://localhost:9000 in your browser.\n"
30+
echo -e "\nListmonk is now up and running. Visit http://localhost:9000 in your browser.\n"
3131
}
3232

3333

install-prod.sh

+50-50
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ check_dependencies() {
3131
if ! exists curl; then
3232
error "curl is not installed."
3333
exit 1
34-
fi
34+
fi
3535

3636
if ! exists docker; then
3737
error "docker is not installed."
3838
exit 1
39-
fi
39+
fi
4040

4141
if ! exists docker-compose; then
4242
error "docker-compose is not installed."
@@ -45,81 +45,81 @@ check_dependencies() {
4545
}
4646

4747
download() {
48-
curl --fail --silent --location --output "$2" "$1"
48+
curl --fail --silent --location --output "$2" "$1"
4949
}
5050

5151
is_healthy() {
52-
info "waiting for db container to be up. retrying in 3s"
53-
health_status="$(docker inspect -f "{{.State.Health.Status}}" "$1")"
54-
if [ "$health_status" = "healthy" ]; then
55-
return 0
56-
else
57-
return 1
58-
fi
52+
info "waiting for db container to be up. retrying in 3s"
53+
health_status="$(docker inspect -f "{{.State.Health.Status}}" "$1")"
54+
if [ "$health_status" = "healthy" ]; then
55+
return 0
56+
else
57+
return 1
58+
fi
5959
}
6060

6161
is_running() {
62-
info "checking if "$1" is running"
63-
status="$(docker inspect -f "{{.State.Status}}" "$1")"
64-
if [ "$status" = "running" ]; then
65-
return 0
66-
else
67-
return 1
68-
fi
62+
info "checking if "$1" is running"
63+
status="$(docker inspect -f "{{.State.Status}}" "$1")"
64+
if [ "$status" = "running" ]; then
65+
return 0
66+
else
67+
return 1
68+
fi
6969
}
7070

7171
generate_password(){
72-
echo $(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
72+
echo $(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
7373
}
7474

7575
get_config() {
76-
info "fetching config.toml from listmonk repo"
77-
download https://raw.githubusercontent.com/knadh/listmonk/master/config.toml.sample config.toml
76+
info "fetching config.toml from listmonk repo"
77+
download https://raw.githubusercontent.com/knadh/listmonk/master/config.toml.sample config.toml
7878
}
7979

8080
get_containers() {
81-
info "fetching docker-compose.yml from listmonk repo"
82-
download https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml docker-compose.yml
81+
info "fetching docker-compose.yml from listmonk repo"
82+
download https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml docker-compose.yml
8383
}
8484

8585
modify_config(){
86-
info "generating a random password"
87-
db_password=$(generate_password)
88-
89-
info "modifying config.toml"
90-
# Replace `db.host=localhost` with `db.host=db` in config file.
91-
sed -i "s/host = \"localhost\"/host = \"listmonk_db\"/g" config.toml
92-
# Replace `db.password=listmonk` with `db.password={{db_password}}` in config file.
93-
# Note that `password` is wrapped with `\b`. This ensures that `admin_password` doesn't match this pattern instead.
94-
sed -i "s/\bpassword\b = \"listmonk\"/password = \"$db_password\"/g" config.toml
95-
# Replace `app.address=localhost:9000` with `app.address=0.0.0.0:9000` in config file.
96-
sed -i "s/address = \"localhost:9000\"/address = \"0.0.0.0:9000\"/g" config.toml
97-
98-
info "modifying docker-compose.yml"
99-
sed -i "s/POSTGRES_PASSWORD=listmonk/POSTGRES_PASSWORD=$db_password/g" docker-compose.yml
86+
info "generating a random password"
87+
db_password=$(generate_password)
88+
89+
info "modifying config.toml"
90+
# Replace `db.host=localhost` with `db.host=db` in config file.
91+
sed -i "s/host = \"localhost\"/host = \"listmonk_db\"/g" config.toml
92+
# Replace `db.password=listmonk` with `db.password={{db_password}}` in config file.
93+
# Note that `password` is wrapped with `\b`. This ensures that `admin_password` doesn't match this pattern instead.
94+
sed -i "s/\bpassword\b = \"listmonk\"/password = \"$db_password\"/g" config.toml
95+
# Replace `app.address=localhost:9000` with `app.address=0.0.0.0:9000` in config file.
96+
sed -i "s/address = \"localhost:9000\"/address = \"0.0.0.0:9000\"/g" config.toml
97+
98+
info "modifying docker-compose.yml"
99+
sed -i "s/POSTGRES_PASSWORD=listmonk/POSTGRES_PASSWORD=$db_password/g" docker-compose.yml
100100
}
101101

102102
run_migrations(){
103-
info "running migrations"
104-
docker-compose up -d db
105-
while ! is_healthy listmonk_db; do sleep 3; done
106-
docker-compose run --rm app ./listmonk --install
103+
info "running migrations"
104+
docker-compose up -d db
105+
while ! is_healthy listmonk_db; do sleep 3; done
106+
docker-compose run --rm app ./listmonk --install
107107
}
108108

109109
start_services(){
110-
info "starting app"
111-
docker-compose up -d app db
110+
info "starting app"
111+
docker-compose up -d app db
112112
}
113113

114114
show_output(){
115-
info "finishing setup"
116-
sleep 3
117-
118-
if is_running listmonk_db && is_running listmonk_app
119-
then completed "Listmonk is now up and running. Visit http://localhost:9000 in your browser."
120-
else
121-
error "error running containers. something went wrong."
122-
fi
115+
info "finishing setup"
116+
sleep 3
117+
118+
if is_running listmonk_db && is_running listmonk_app
119+
then completed "Listmonk is now up and running. Visit http://localhost:9000 in your browser."
120+
else
121+
error "error running containers. something went wrong."
122+
fi
123123
}
124124

125125

0 commit comments

Comments
 (0)