1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh.git synced 2024-09-03 19:46:01 +02:00
* standard app service registration

* Logging with static file name

* Update logging

* Rename check_process.default to check_process

* systemd change log name

* Update install logging

* log not handled by systemd

* logging handled by synapse app service

* remove message fail2ban

* add log

* remove linematch

* get synapse domain and server_name

* ynh_app_setting_get

* app port arg & instance_number

* domain not needed and port added
This commit is contained in:
Gredin67 2020-04-26 01:44:37 +02:00 committed by GitHub
parent 8c1821c2a8
commit bc011d6244
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 15 deletions

View file

@ -24,20 +24,31 @@
"arguments": {
"install": [
{
"name": "domain",
"type": "domain",
"name": "port",
"type": "string",
"ask": {
"en": "Choose the domain name where the local Matrix/Synapse instance is installed.",
"fr": "Choisissez le nom de domaine associé à l'instance locale Matrix/Synapse."
"en": "Choose a port for communication between app service and home server",
"fr": "Choisissez un port pour la communication entre l'app service et le home server"
},
"example": "domain.org"
"example": "29318",
"default": "8449"
},
{
"name": "synapsenumber",
"type": "string",
"ask": {
"en": "Choose the synapse instance number to communicate with app service",
"fr": "Choisissez le numéro de l'instance synapse qui doit communiquer avec l'app service"
},
"example": "2",
"default": "1"
},
{
"name": "whatsappbot",
"type": "string",
"ask": {
"en": "Choose the local Matrix/Synapse user name of the WhatsApp bot.",
"fr": "Choisissez le nom d'utilisateur local Matrix/Synapse du robot WhatsApp."
"en": "Choose the local Matrix/Synapse user name of the WhatsApp bot",
"fr": "Choisissez le nom d'utilisateur local Matrix/Synapse du robot WhatsApp"
},
"example": "whatsappbot",
"help": {
@ -50,8 +61,8 @@
"name": "botadmin",
"type": "string",
"ask": {
"en": "Choose the Matrix account administrator of the WhatsApp bot.",
"fr": "Choisissez le compte Matrix administrateur du robot WhatsApp."
"en": "Choose the Matrix account administrator of the WhatsApp bot",
"fr": "Choisissez le compte Matrix administrateur du robot WhatsApp"
},
"example": "@johndoe:domain.org or @johndoe:matrix.org",
"help": {
@ -64,8 +75,8 @@
"name": "botusers",
"type": "string",
"ask": {
"en": "Choose Matrix user(s) authorized to use the WhatsApp bot.",
"fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser le robot WhatsApp."
"en": "Choose Matrix user(s) authorized to use the WhatsApp bot",
"fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser le robot WhatsApp"
},
"example": "@johndoe:domain.org or matrix.org or *",
"default": "",

View file

@ -26,8 +26,9 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
#domain=$YNH_APP_ARG_DOMAIN
#path_url=$YNH_APP_ARG_PATH
port=$YNH_APP_ARG_PORT
whatsappbot=$YNH_APP_ARG_WHATSAPPBOT
botadmin=$YNH_APP_ARG_BOTADMIN
botusers=$YNH_APP_ARG_BOTUSERS
@ -47,6 +48,16 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
### db names, ...
app=$YNH_APP_INSTANCE_NAME
if [ $YNH_APP_INSTANCE_NUMBER -eq "1" ]
then
server_name=$(ynh_app_setting_get --app synapse --key server_name)
domain=$(ynh_app_setting_get --app synapse --key domain)
else
server_name=$(ynh_app_setting_get --app synapse__$YNH_APP_INSTANCE_NUMBER --key server_name)
domain=$(ynh_app_setting_get --app synapse__$YNH_APP_INSTANCE_NUMBER --key domain)
fi
#=================================================
# SET CONSTANTS
#=================================================
@ -86,6 +97,8 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde
ynh_script_progression --message="Storing installation settings..." --time --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
ynh_app_setting_set --app=$app --key=port --value=$port
#ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=whatsappbot --value=$whatsappbot
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
@ -241,17 +254,17 @@ cp example-config.yaml config.yaml
ynh_replace_string --match_string="address: https://example.com" --replace_string="address: https://$domain" --target_file="$final_path/config.yaml"
# The domain of the homeserver (for MXIDs, etc).
#"domain: example.com"
ynh_replace_string --match_string="domain: example.com" --replace_string="domain: $domain" --target_file="$final_path/config.yaml"
ynh_replace_string --match_string="domain: example.com" --replace_string="domain: $server_name" --target_file="$final_path/config.yaml"
# Application service host/registration related details.
# Changing these values requires regeneration of the registration.
#appservice:
# The address that the homeserver can use to connect to this appservice.
#ynh_replace_string --match_string="address: http://localhost:29318" --replace_string="address: http://localhost:8449" --target_file="$final_path/config.yaml"
ynh_replace_string --match_string="address: http://localhost:29318" --replace_string="address: http://localhost:$port" --target_file="$final_path/config.yaml"
# The hostname and port where this appservice should listen.
#ynh_replace_string --match_string="hostname: 0.0.0.0" --replace_string="hostname: 0.0.0.0" --target_file="$final_path/config.yaml"
#ynh_replace_string --match_string="port: 29318" --replace_string="port: 8449" --target_file="$final_path/config.yaml"
ynh_replace_string --match_string="port: 29318" --replace_string="port: $port" --target_file="$final_path/config.yaml"
# Database config.
#database: