Skip to content

Commit d9b3060

Browse files
authored
bugs: allow configuration of smtp per tracker (#547)
Towards #546, allows us to set SMTP settings on a per-tracker basis. Adds some sample secrets for roundup to emulate what we have in prod and demonstrate this feature.
1 parent 28acefd commit d9b3060

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

pillar/dev/secrets/bugs.sls

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
roundup_secrets:
2+
mail:
3+
roundup:
4+
domain: roundup-tracker.org
5+
trackers:
6+
cpython:
7+
django:
8+
secret_key: foobar
9+
github:
10+
secret: deadbeef
11+
client_id: beefdead
12+
client_secret: cafebeef

pillar/dev/top.sls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ base:
1515

1616
'bugs':
1717
- match: nodegroup
18+
- secrets.bugs
1819
- bugs
1920
- firewall.bugs
2021

salt/bugs/config/config.ini.jinja

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,27 +470,27 @@ level = {{ logging__level }}
470470
# explicitly include a domain.
471471
# Do not include the '@' symbol.
472472
# Default: NO DEFAULT
473-
domain = {{ pillar.get('roundup_secrets', {}).get('mail__domain', 'roundup.psfhosted.org') }}
473+
domain = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('domain', 'roundup.psfhosted.org') }}
474474

475475
# SMTP mail host that roundup will use to send mail
476476
# Default: NO DEFAULT
477-
host = {{ pillar.get('roundup_secrets', {}).get('mail__host', 'localhost') }}
477+
host = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('host', 'localhost') }}
478478

479479
# SMTP login name.
480480
# Set this if your mail host requires authenticated access.
481481
# If username is not empty, password (below) MUST be set!
482482
# Default:
483-
username = {{ pillar.get('roundup_secrets', {}).get('mail__username', '') }}
483+
username = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('username', '') }}
484484

485485
# SMTP login password.
486486
# Set this if your mail host requires authenticated access.
487487
# Default: NO DEFAULT
488-
password = {{ pillar.get('roundup_secrets', {}).get('mail__password', '') }}
488+
password = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('password', '') }}
489489

490490
# Default port to send SMTP on.
491491
# Set this if your mail server runs on a different port.
492492
# Default: 25
493-
port = {{ pillar.get('roundup_secrets', {}).get('mail__port', '25') }}
493+
port = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('port', '25') }}
494494

495495
# The local hostname to use during SMTP transmission.
496496
# Set this if your mail server requires something specific.
@@ -501,7 +501,7 @@ local_hostname = {{ mail__local_hostname }}
501501
# (Transport Layer Security) then set this option to 'yes'.
502502
# Allowed values: yes, no
503503
# Default: no
504-
tls = {{ pillar.get('roundup_secrets', {}).get('mail__tls', 'no') }}
504+
tls = {{ pillar.get('roundup_secrets', {}).get('mail', {}).get(tracker, {}).get('tls', 'no') }}
505505

506506
# If TLS is used, you may set this option to the name
507507
# of a PEM formatted file that contains your private key.

0 commit comments

Comments
 (0)