Skip to content

Variable-name adjustments (style)#1

Merged
polarathene merged 1 commit intopolarathene:feat/hybrid-cert-supportfrom
georglauterbach:feat/hybrid-cert-support
Sep 30, 2020
Merged

Variable-name adjustments (style)#1
polarathene merged 1 commit intopolarathene:feat/hybrid-cert-supportfrom
georglauterbach:feat/hybrid-cert-support

Conversation

@georglauterbach
Copy link
Copy Markdown

I just renamed the variables to have an uppercase name for your convenience because I didn't want to bother you with this again:)

Notice the first block in the diff:

@@ -95,7 +95,7 @@ CHKSUM_FILE=/tmp/docker-mailserver-config-chksum

- function register_functions()
+ function regiter_functions()

just to make sure any TravisCI checks are not failing because of this renaming. We should do this again in the end when your PR (tomav#1629) is ready for merging and tests are successful.

@georglauterbach georglauterbach changed the base branch from master to feat/hybrid-cert-support September 30, 2020 12:23
@georglauterbach georglauterbach changed the title Minor adjustments Variable-name adjustments (style) Sep 30, 2020
@polarathene
Copy link
Copy Markdown
Owner

polarathene commented Sep 30, 2020

Oh...seems my local master I branched off was before your changes were merged, I'll rebase to get all that (EDIT: Nope apparently I misunderstood the extras).

I intentionally didn't use upper case as they're local vars, I'm used to uppercase for constants or ENV vars, but if the code style has changed to that I'll adopt it.

I did glimpse this from current upstream master:

https://github.com/tomav/docker-mailserver/blob/a0c2dc27c8cb75ef97308c3234945f26e116fa33/target/start-mailserver.sh#L680

      # Setting variables for better readability
      user=$(echo "${login}" | cut -d @ -f1)
      domain=$(echo "${login}" | cut -d @ -f2)

      user_attributes=""

# ...

IFS=':' ; read -r -a USER_QUOTA < <(grep "${user}@${domain}:" -i /tmp/docker-mailserver/dovecot-quotas.cf)

# ...

echo "${login} ${domain}/${user}/" >> /etc/postfix/vmailbox

Were these missed or are they lowercase globals? (they're not declared with local scope, I'm not that experienced with shell/bash, so I might be misunderstanding what's going on there conventions wise)

@polarathene polarathene merged commit 0c64a3a into polarathene:feat/hybrid-cert-support Sep 30, 2020
@georglauterbach
Copy link
Copy Markdown
Author

georglauterbach commented Sep 30, 2020

There are many inconsistencies left in start-mailserver.sh even after my refactoring. You just showed an example. But: The variables are also present in check-for-change.sh. If we rename them, we should do it consistent across the board. I just refactored what you introduced with your PR however. There is more work to make this huge script 100% consistent.

PS: We (with the new styling guide) don't differentiate between the scope of the variables when naming them, i.e. they are always just uppercase. The local keyword does that for us:)

@polarathene
Copy link
Copy Markdown
Owner

Ok, no problem. The user-patches addition is to sync with your recent commit to upstream master?

The spelling error with the regiter_functions() is to be reverted for CI trigger?

@georglauterbach
Copy link
Copy Markdown
Author

georglauterbach commented Sep 30, 2020

Ok, no problem. The user-patches addition is to sync with your recent commit to upstream master?

Correct. This is more or less a "leftover" from my master where I copied something from.

The spelling error with the regiter_functions() is to be reverted for CI trigger?

More or less. When I refactored, I was never quite sure where some error came from, for example the user quota error. Therefore it's best to isolate these causes and change the spelling in the end.

PS: If you want, you can make this:

      # Setting variables for better readability
      user=$(echo "${login}" | cut -d @ -f1)
      domain=$(echo "${login}" | cut -d @ -f2)

      user_attributes=""

# ...

IFS=':' ; read -r -a USER_QUOTA < <(grep "${user}@${domain}:" -i /tmp/docker-mailserver/dovecot-quotas.cf)

# ...

echo "${login} ${domain}/${user}/" >> /etc/postfix/vmailbox

more consistent, you should just rename it in check-for-changes.sh too. (Not sure whether they interfere)
You can see the diff for this on my fork of your repo on this exact branch.

@polarathene
Copy link
Copy Markdown
Owner

PS: If you want, you can make this:

Sorry, I don't have the spare time to allocate to fixing code style(as much as I value consistency myself), I'm mostly interested in completing my main PR for the project(testing environment setup now, have run initial tests, now need to work through my checklist), possibly adding a bit more to the wiki and after a bit more polish publishing a repo or sending a PR of the docker-compose local TLS setup (CoreDNS for resolving FQDNs with mail records and ACME DNS challenges, smallstep's step-ca for private CA and ACME provisioner, acmebot for provisioning the certs via ACME, the mailserver and any tests like testssl.sh).

After all that, I have more on my backlog to wrap up elsewhere 😅

@georglauterbach
Copy link
Copy Markdown
Author

Of course, this was just an idea:) I will do this later :D

polarathene pushed a commit that referenced this pull request Feb 9, 2021
…_more_tests

Feature/extract even more tests
polarathene pushed a commit that referenced this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants