Restructure start-mailserver.sh #338#393
Merged
tomav merged 1 commit intodocker-mailserver:masterfrom Dec 17, 2016
Merged
Conversation
Contributor
|
Hi @alinmear, I think it's a pretty good start. |
Contributor
|
@alinmear could you open an issue with suggested improvements? Thank you. |
RichardFevrier
pushed a commit
to RichardFevrier/docker-mailserver
that referenced
this pull request
Aug 26, 2019
Restructure start-mailserver.sh docker-mailserver#338
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To make it easier to extend and maintain the logics of initialization of the mailserver and it's components i restructured the whole script into small junks/functions.
Let me explain the logics here:
We have 5 steps to bring the mailserver up (they are running after one another) :
I also made a simple registration logic, for integrating new features easily:
Integrating Checks and improve this pull request:
While making integration tests one of the things i recognized was, that we are lacking checks, when a setup step is not performed successfully (for this see my TODOs within the script). Because while executing the 5 steps (check, setup, fix, misc, start-daemons) i implemented to check for a proper return value. right now when there is an error while executing a script the return value $? != 0 --> execution part failed --> script becomes defunc state.
This can be the starting point to make proper checks within each part of the script. If this is not wanted, we should comment out the check whether a function return 0 or not.
Global and Default Vars:
On top of the script i made an associative array to place global variables. the _setup_default_vars() function loops over this array and exports the variable. With this we can define Default/Global Variables easily without having to mess around.
Improvements are welcome!