runeasymail / easymail

Easy way to install a mail server.
http://easy.supersecure.email/
MIT License
61 stars 18 forks source link

Error Handling if Enter is pressed when prompted for Hostname #155

Closed cruisemaniac closed 7 years ago

cruisemaniac commented 7 years ago

The installer proceeds with NULL value for hostname if user presses enter (without entering any value) when asked to "Enter Hostname".

System should not proceed or should Ideally pick up the -H parameter that is provided when docker container is created:

docker run -it -p=110:110 -p=25:25 -p=995:995 -p=8080:80 -p=44380:443  -p=587:587 -p=993:993 -p=143:143 -p=465:465 -h "mail.example.com" --name="easymail" -v /etc/ssl/certs/:/etc/ssl/certs/ ubuntu:16.04 /bin/sh -c "if [ -f /run.sh ]; then bash /run.sh; fi; exec /bin/bash"

What / where is the -h paramter used for ?

pavel-tashev commented 7 years ago

Can you propose a solution?

cruisemaniac commented 7 years ago

lets start with a set -e

and simple traps...

if [[ -n "$input" ]] ; then
  echo "error happened with input"
  exit 1
fi

Let me know if this will work?

cruisemaniac commented 7 years ago

And I'd presume, that since we're heading with docker, all inputs should be captured and validated BEFORE SCRIPT START...

GyunerZeki commented 7 years ago

This should be applicable to post_install.sh too.

The current command for running is

docker run -itd  -p=110:110 -p=25:25 -p=995:995 -p=80:80 -p=443:443 -p=587:587 -p=993:993 -p=143:143 -p=465:465 -h "test.example.com" --name="easymail" XXXXXX /bin/sh -c "bash /opt/easymail/post_install.sh test.example.com; exec /bin/bash"

We can make that to

docker run -itd  -p=110:110 -p=25:25 -p=995:995 -p=80:80 -p=443:443 -p=587:587 -p=993:993 -p=143:143 -p=465:465 -h "test.example.com" --name="easymail" XXXXXX /bin/sh -c "bash /opt/easymail/post_install.sh; exec /bin/bash"

And after that inside in post_install.sh we can take the "test.example.com" from the hostname.

Is that your proposal?

cruisemaniac commented 7 years ago

yes that is...

GyunerZeki commented 7 years ago

That's great. I totally agree with you. Can you provide a Pull request for this changes?

GyunerZeki commented 7 years ago

@cruisemaniac the issue is resolved on v1.0.9, closing the ticket.