Merge ~hloeung/charm-k8s-mattermost/+git/charm-k8s-mattermost:master into charm-k8s-mattermost:master

Proposed by Haw Loeung
Status: Merged
Approved by: Tom Haddon
Approved revision: 368e0e120f80f233ad6aeb04b213ed0f95df94b5
Merged at revision: 88b29bedae73f03b8a74a0c80b169e5e3521abe9
Proposed branch: ~hloeung/charm-k8s-mattermost/+git/charm-k8s-mattermost:master
Merge into: charm-k8s-mattermost:master
Diff against target: 74 lines (+45/-1)
2 files modified
config.yaml (+30/-0)
src/charm.py (+15/-1)
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Canonical IS Reviewers Pending
Review via email: mp+406618@code.launchpad.net

Commit message

Allow overriding SMTP AUTH settings and Notification From & Reply-To addresses (LP:1915672)

To post a comment you must log in.
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :

LGTM, thx

review: Approve
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision 88b29bedae73f03b8a74a0c80b169e5e3521abe9

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index 5827200..08d4c5b 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -171,11 +171,41 @@ options:
6
7 This requires configuration on the S3 side, as well as a suitable Mattermost licence.
8 default: false
9+ smtp_connection_security:
10+ type: string
11+ description: |
12+ The connection security to use for the outgoing SMTP relay host.
13+ default: 'STARTTLS'
14+ smtp_from_address:
15+ type: string
16+ description: |
17+ The notification from address for outgoing mail.
18+ default: 'noreply+chat@mydomain.local'
19 smtp_host:
20 type: string
21 description: |
22 The hostname or IP address of the outgoing SMTP relay host.
23 default: ''
24+ smtp_password:
25+ type: string
26+ description: |
27+ The SMTP AUTH password to use for the outgoing SMTP relay host.
28+ default: ''
29+ smtp_port:
30+ type: int
31+ description: |
32+ The port of the outgoing SMTP relay host.
33+ default: 25
34+ smtp_reply_to_address:
35+ type: string
36+ description: |
37+ The Reply-To address.
38+ default: ''
39+ smtp_user:
40+ type: string
41+ description: |
42+ The SMTP AUTH user to use for the outgoing SMTP relay host.
43+ default: ''
44 sso:
45 type: boolean
46 description: |
47diff --git a/src/charm.py b/src/charm.py
48index 9416f62..140c018 100755
49--- a/src/charm.py
50+++ b/src/charm.py
51@@ -511,8 +511,22 @@ class MattermostK8sCharm(CharmBase):
52 if not config['smtp_host']:
53 return
54
55+ enable_smtp_auth = 'false'
56+ if config['smtp_user'] and config['smtp_password']:
57+ enable_smtp_auth = 'true'
58+
59+ # https://github.com/mattermost/mattermost-server/blob/master/model/config.go#L1532
60 get_env_config(pod_spec, self.app.name).update(
61- {'MM_EMAILSETTINGS_SMTPPORT': 25, 'MM_EMAILSETTINGS_SMTPSERVER': config['smtp_host']}
62+ {
63+ 'MM_EMAILSETTINGS_CONNECTIONSECURITY': config['smtp_connection_security'],
64+ 'MM_EMAILSETTINGS_ENABLESMTPAUTH': enable_smtp_auth,
65+ 'MM_EMAILSETTINGS_FEEDBACKEMAIL': config['smtp_from_address'],
66+ 'MM_EMAILSETTINGS_REPLYTOADDRESS': config['smtp_reply_to_address'],
67+ 'MM_EMAILSETTINGS_SMTPPASSWORD': config['smtp_password'],
68+ 'MM_EMAILSETTINGS_SMTPPORT': config['smtp_port'],
69+ 'MM_EMAILSETTINGS_SMTPSERVER': config['smtp_host'],
70+ 'MM_EMAILSETTINGS_SMTPUSERNAME': config['smtp_user'],
71+ }
72 )
73
74 def configure_pod(self, event):

Subscribers

People subscribed via source and target branches