add publik-emailconf
This commit is contained in:
parent
c5c3f68142
commit
2988a9caf2
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python3
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import yaml
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('site', help='free form site name, including test/prod/else hints')
|
||||
args = parser.parse_args()
|
||||
|
||||
template = """ADMINS = (('Admin EO', 'admin+{site}.{brique}@entrouvert.com'),)
|
||||
EMAIL_SUBJECT_PREFIX = '[{site} {brique}]'
|
||||
SERVER_EMAIL = 'admin+{site}.{brique}@entrouvert.com'"""
|
||||
|
||||
with open('/etc/publik/publik.conf') as fh:
|
||||
briques = yaml.load(fh.read())['defaults']['briques']
|
||||
|
||||
for brique in briques:
|
||||
if brique == 'authentic2-multitenant':
|
||||
briquename = 'authentic'
|
||||
else:
|
||||
briquename = brique
|
||||
|
||||
settings_d ='/etc/%s/settings.d' % brique
|
||||
if not os.path.isdir(settings_d):
|
||||
os.mkdir(settings_d)
|
||||
|
||||
with open('/etc/%s/settings.d/email.py' % brique, 'w') as fh:
|
||||
fh.write(template.format(site=args.site, brique=briquename))
|
||||
|
||||
for brique in briques:
|
||||
subprocess.call('systemctl restart %s' % brique, shell=True)
|
|
@ -15,6 +15,16 @@ defaults:
|
|||
passerelle: passerelle
|
||||
wcs: wcs
|
||||
welco: welco
|
||||
briques:
|
||||
- authentic2-multitenant
|
||||
- bijoe
|
||||
- chrono
|
||||
- combo
|
||||
- hobo
|
||||
- fargo
|
||||
- passerelle
|
||||
- welco
|
||||
- wcs
|
||||
|
||||
instances:
|
||||
local.publik: {}
|
||||
|
|
Loading…
Reference in New Issue