1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jitsi_ynh.git synced 2024-09-03 19:35:57 +02:00
This commit is contained in:
yalh76 2022-04-06 02:19:13 +02:00
parent e8d7b67c40
commit 71ee464c3f
2 changed files with 21 additions and 124 deletions

View file

@ -1,133 +1,14 @@
## Config panel are available from webadmin > Apps > YOUR_APP > Config Panel Button
## Those panels let user configure some params on their apps using a friendly interface,
## and remove the need to manually edit files from the command line.
## From a packager perspective, this .toml is coupled to the scripts/config script,
## which may be used to define custom getters/setters. However, most use cases
## should be covered automagically by the core, thus it may not be necessary
## to define a scripts/config at all!
## -----------------------------------------------------------------------------
## IMPORTANT: In accordance with YunoHost's spirit, please keep things simple and
## do not overwhelm the admin with tons of misunderstandable or advanced settings.
## -----------------------------------------------------------------------------
## The top level describe the entire config panels screen.
## The version is a required property.
## Here a small reminder to associate config panel version with YunoHost version
## | Config | YNH | Config panel small change log |
## | ------ | --- | ------------------------------------------------------- |
## | 0.1 | 3.x | 0.1 config script not compatible with YNH >= 4.3 |
## | 1.0 | 4.3.x | The new config panel system with 'bind' property |
version = "1.0"
## (optional) i18n property let you internationalize questions, however this feature
## is only available in core configuration panel (like yunohost domain config).
## So in app config panel this key is ignored for now, but you can internationalize
## by using a lang dictionary (see property name bellow)
# i18n = "prefix_translation_key"
################################################################################
#### ABOUT PANELS
################################################################################
## The next level describes web admin panels
## You have to choose an ID for each panel, in this example the ID is "main"
## Keep in mind this ID will be used in CLI to refer to your question, so choose
## something short and meaningfull.
## In the webadmin, each panel corresponds to a distinct tab / form
[main]
## Define the label for your panel
## Internationalization works similarly to the 'description' and 'ask' questions in the manifest
name = "Main configuration"
#name.en = "Main configuration"
#name.fr = "Configuration principale"
#name.es = "Configuración principal"
## (optional) If you need to trigger a service reload-or-restart after the user
# change a question in this panel, you can add your service in the list.
services = ["__APP__-jicofo","__APP__-videobridge"]
# or services = ["nginx", "__APP__"] to also reload-or-restart nginx
## (optional) This help properties is a short help displayed on the same line
## than the panel title but not displayed in the tab.
# help = ""
############################################################################
#### ABOUT SECTIONS
############################################################################
## A panel is composed of one or several sections.
##
## Sections are meant to group questions together when they correspond to
## a same subtopic. This impacts the rendering in terms of CLI prompts
## and HTML forms
##
## You should choose an ID for your section, and prefix it with the panel ID
## (Be sure to not make a typo in the panel ID, which would implicitly create
## an other entire panel)
##
## We use the context of pepettes_ynh as an example,
## which is a simple donation form app written in python,
## and for which the admin will want to edit the configuration
[main.config]
## (optional) Defining a proper title for sections is not mandatory
## and depends on the exact rendering you're aiming for the CLI / webadmin
name = "Global configurations"
#name.en = "Domains configurations"
#name.fr = "Configuratin des domaines"
#name.es = "Configuración de dominios"
## (optional) This help properties is a short help displayed on the same line
## than the section title, meant to provide additional details
#help = "Domains are the name which appear in your browther navigation bar (eg: sub.domain.tld)"
#help.en = "Domains are the name which appear in your browther navigation bar (eg: sub.domain.tld)"
#help.fr = "Les domaines sont les noms qui apparaissent dans la barre de nvigation de votre navigateur (ex : sub.domain.tld)"
#help.es = "los dominios son los nombres que apparecent en la barra de navegación de su navegador (ex: sub.domain.tld)"
## (optional) As for panel, you can specify to trigger a service
## reload-or-restart after the user change a question in this section.
## This property is added to the panel property, it doesn't deactivate it.
## So no need to replicate, the service list from panel services property.
# services = []
## (optional) By default all questions are optionals, but you can specify a
## default behaviour for question in the section
#optional = true
## (optional) It's also possible with the 'visible' property to only
## display the section depending on the user's answers to previous questions.
##
## Be careful that the 'visible' property should only refer to **previous** questions
## Hence, it should not make sense to have a "visible" property on the very first section.
##
## Also, keep in mind that this feature only works in the webadmin and not in CLI
## (therefore a user could be prompted in CLI for a question that may not be relevant)
# visible = true
########################################################################
#### ABOUT QUESTIONS
########################################################################
[main.config.max_memory]
bind = "null"
ask.en = "Max memory to use for VM"
#ask.fr = "Utilisateurs simultanés maximum"
#ask.es = "Maximo de usuario simultaneo"
type = "number"
#example = "domain.tld or sub.domain.tld"
#example.en = "domain.tld or sub.domain.tld"
#example.fr = "domain.tld ou sub.domain.tld"
#example.es = "domain.tld o sub.domain.tld"
help = "One user consume about 1,5 Mib memory, for example if plan to have max 50 simultaneous users this parameter should be set to 75 mb"
#help.en = "Fill the domain name of the users identifiers if different to the server domain"
#help.fr = "Saisissez le nom de domaine des identifiants utilisateurs si différent au domaine du serveur"
#help.es = "Ingresa el nombre de dominio del nombre de usuario si diferente del dominio del servidor"
#pattern.regexp = '^(\w{3,30})(\.(\w{3,30}))*$'
#pattern.error = "The domain should be at least like domain.tld or better sub.domain.tld"
#pattern.error.en = "The domain should be at least like domain.tld or better sub.domain.tld"
#pattern.error.fr = "Le domaine doit etre au moind du type domain.tld ou mieux sub.domain.tld"
#pattern.error.es = "El dominio debe estar al menos del typo domain.tld o mejor sub.domain.tld"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC START
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -12,14 +12,20 @@ source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
# RETRIEVE ARGUMENTS
#=================================================
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__max_memory(){
local max_memory=$(ynh_app_setting_get --app=$app --key=max_memory)
# If max_memory doesn't exist, create it and set to default 3074 mb value
if [ -z "$max_memory" ]; then
max_memory=3072
max_memory=75
ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory
fi
@ -28,6 +34,14 @@ value: $max_memory
EOF
}
#=================================================
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#=================================================
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__max_memory(){
#=================================================
@ -54,19 +68,21 @@ set__max_memory(){
#=================================================
# SET SETTINGS
#=================================================
ynh_app_setting_set --app=$app --key=max_memory --value=$max_memory
#=================================================
# UPDATE CONFIG FILES
#=================================================
ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config"
ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config"
ynh_script_progression -l --message="Upgrade of $app completed"
ynh_script_progression -l --message="Configuration of $app updated"
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1
ynh_app_config_run $1