1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cinny_ynh.git synced 2024-09-03 18:16:13 +02:00

add default server

This commit is contained in:
Éric Gaspar 2023-04-07 10:21:01 +02:00 committed by Félix Piédallu
parent 83c1d754ff
commit 23c871d8a9
5 changed files with 27 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{ {
"defaultHomeserver": 0, "defaultHomeserver": 0,
"homeserverList": [ "homeserverList": [
"__DEFAULT_HOME_SERVER__" __DEFAULT_HOME_SERVER_LIST__"matrix.org"
], ],
"allowCustomHomeservers": true "allowCustomHomeservers": true
} }

0
config_panel Normal file
View file

View file

@ -8,6 +8,19 @@
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
cinny_install_config_file() {
# This helper detects if default_home_server is matrix.org to prevent duplicates in the list.
# Add a Json element in the config file
if [[ "$default_home_server" == "matrix.org" ]]; then
default_home_server_list=""
else
default_home_server_list="\"$default_home_server\",\n "
fi
ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -29,14 +29,12 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CINNY CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring Cinny..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
# Copy over the Cinny configuration file cinny_install_config_file
ynh_add_config --template="../conf/cinny.json" --destination="$install_dir/config.json"
# Fix any permissions in the install dir
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"

View file

@ -16,8 +16,17 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If default_home_server doesn't exist, create it
if [ -z "${default_home_server:-}" ]; then
default_home_server="matrix.org"
ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server
cinny_install_config_file
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE