1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/listmonk_ynh.git synced 2024-09-03 19:36:15 +02:00
listmonk_ynh/scripts/_common.sh

41 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2022-03-28 11:33:36 +02:00
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
# FIXME https://listmonk.app/docs/swagger/#/Settings/getSettings
_listmonk_configure_with_api () {
python -c """
from urllib.request import urlopen, Request
with urlopen('http://localhost:$port/api/settings') as url:
data = json.load(url)
data['data']['app.root_url'] = "https://$domain"
data['data']['app.from_email'] = "listmonk <noreply@$domain>"
data['data']['smtp'][0]['host'] = "127.0.0.1"
data['data']['smtp'][0]['auth_protocol'] = "plain"
data['data']['smtp'][0]['username'] = "$app"
data['data']['smtp'][0]['password'] = "$mail_pwd"
data_bytes = bytes(json.dumps(data), encoding='utf8')
request = Request('http://localhost:$port/api/settings', method='PUT', data=data_bytes, headers={'Content-Type': 'application/json'})
with urlopen(request) as response:
print(response.read())
"""
}
2022-03-28 11:33:36 +02:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================