mirror of
https://github.com/YunoHost-Apps/listmonk_ynh.git
synced 2024-09-03 19:36:15 +02:00
301a199172
* Enable allow_email and add post install doc * WIP post config with API * Auto-update README * tests: add missing args for upgrade from * tests: add missing args for upgrade from² --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
40 lines
1.3 KiB
Bash
40 lines
1.3 KiB
Bash
#!/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())
|
|
"""
|
|
}
|
|
|
|
#=================================================
|
|
# EXPERIMENTAL HELPERS
|
|
#=================================================
|
|
|
|
#=================================================
|
|
# FUTURE OFFICIAL HELPERS
|
|
#=================================================
|