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

WIP post config with API

This commit is contained in:
Tagada 2023-09-30 11:36:18 +02:00
parent 218e87db0a
commit 6c2ea4595d

View file

@ -8,6 +8,29 @@
# 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())
"""
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================