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

Proposed by Paul Collins
Status: Merged
Approved by: Paul Collins
Approved revision: 4ffbd62389a2c4b25eadfd3e0b16a51e9a28607e
Merged at revision: 7ad6219bac991f15391b16d8392bf8c3596c143f
Proposed branch: ~pjdc/charm-k8s-mattermost/+git/charm-k8s-mattermost:siteurl
Merge into: charm-k8s-mattermost:master
Prerequisite: ~pjdc/charm-k8s-mattermost/+git/charm-k8s-mattermost:psql-relation
Diff against target: 49 lines (+18/-5)
2 files modified
config.yaml (+7/-0)
src/charm.py (+11/-5)
Reviewer Review Type Date Requested Status
Paul Collins me Approve
Stuart Bishop (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+384512@code.launchpad.net

Commit message

add site_url and wire it up

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

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

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
Paul Collins (pjdc) wrote :

Note prereq.

Revision history for this message
Stuart Bishop (stub) wrote :

Seems fine. Maybe the site_url option should be required, rather than 'optional but required if you want things to actually work'?

review: Approve
Revision history for this message
Paul Collins (pjdc) :
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Merge proposal is approved, but source revision has changed, setting status to needs review.

Revision history for this message
Paul Collins (pjdc) :
review: Approve (me)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 7ad6219bac991f15391b16d8392bf8c3596c143f

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 603ba30..733c53d 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -7,3 +7,10 @@ options:
6 type: boolean
7 description: Allows users to sign up from the root page without an invite
8 default: false
9+ site_url:
10+ type: string
11+ description: |
12+ The URL by which the site is reached. This must be set for all of Mattermost's features to work correctly.
13+
14+ For more information, see https://docs.mattermost.com/administration/config-settings.html#site-url
15+ default: ''
16diff --git a/src/charm.py b/src/charm.py
17index 0fcc304..230651c 100755
18--- a/src/charm.py
19+++ b/src/charm.py
20@@ -110,6 +110,16 @@ class MattermostK8sCharm(CharmBase):
21 mattermost_image_details = self.mattermost_image.fetch()
22 self.model.unit.status = MaintenanceStatus('Configuring pod')
23 config = self.model.config
24+
25+ pod_config = {
26+ 'MATTERMOST_HTTPD_LISTEN_PORT': int(config['mattermost_port']),
27+ 'MM_SQLSETTINGS_DATASOURCE': self.state.db_uri,
28+ 'MM_ENABLEOPENSERVER': config['open_server'],
29+ }
30+
31+ if config['site_url']:
32+ pod_config['MM_SERVICESETTINGS_SITEURL'] = config['site_url']
33+
34 self.model.pod.set_spec({
35 'containers': [{
36 'name': self.framework.model.app.name,
37@@ -118,11 +128,7 @@ class MattermostK8sCharm(CharmBase):
38 'containerPort': int(self.framework.model.config['mattermost_port']),
39 'protocol': 'TCP',
40 }],
41- 'config': {
42- 'MATTERMOST_HTTPD_LISTEN_PORT': int(config['mattermost_port']),
43- 'MM_SQLSETTINGS_DATASOURCE': self.state.db_uri,
44- 'MM_ENABLEOPENSERVER': config['open_server'],
45- },
46+ 'config': pod_config,
47 }]
48 })
49 self.state.is_started = True

Subscribers

People subscribed via source and target branches