mirror of
https://github.com/YunoHost-Apps/chatonsinfos_ynh.git
synced 2024-09-03 18:15:58 +02:00
[wip] Config panel logic and scripts
This commit is contained in:
parent
5df582efe4
commit
a58f3fbc3d
8 changed files with 431 additions and 425 deletions
|
@ -292,219 +292,148 @@ services = []
|
||||||
type = "url"
|
type = "url"
|
||||||
bind = "organization.funding.custom"
|
bind = "organization.funding.custom"
|
||||||
|
|
||||||
|
[host]
|
||||||
|
name = "Hébergement"
|
||||||
|
[host.provider]
|
||||||
|
name = "Fournisseur"
|
||||||
|
[host.provider.name]
|
||||||
|
ask.en = "Nom de l'hébergeur"
|
||||||
|
help.en = "Hébergeur de la machine qui fait tourner le service, dans le cas d'un auto-hébergement c'est vous !"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
#### ABOUT QUESTIONS
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
## A section is compound of one or several questions.
|
|
||||||
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
## IMPORTANT: as for panel and section you have to choose an ID, but this
|
|
||||||
## one should be unique in all this document, even if the question is in
|
|
||||||
## an other panel.
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
## You can use same questions types and properties than in manifest.yml
|
|
||||||
## install part. However, in YNH 4.3, a lot of change has been made to
|
|
||||||
## extend availables questions types list.
|
|
||||||
## See: TODO DOC LINK
|
|
||||||
|
|
||||||
[main.customization.project_name]
|
|
||||||
|
|
||||||
## (required) The ask property is equivalent to the ask property in
|
|
||||||
## the manifest. However, in config panels, questions are displayed on the
|
|
||||||
## left side and therefore have less space to be rendered. Therefore,
|
|
||||||
## it is better to use a short question, and use the "help" property to
|
|
||||||
## provide additional details if necessary.
|
|
||||||
ask.en = "Name of the project"
|
|
||||||
|
|
||||||
## (required) The type property indicates how the question should be
|
|
||||||
## displayed, validated and managed. Some types have specific properties.
|
|
||||||
##
|
|
||||||
## Types available: string, boolean, number, range, text, password, path
|
|
||||||
## email, url, date, time, color, select, domain, user, tags, file.
|
|
||||||
##
|
|
||||||
## For a complete list with specific properties, see: TODO DOC LINK
|
|
||||||
type = "string"
|
type = "string"
|
||||||
|
bind = "host.name"
|
||||||
|
|
||||||
########################################################################
|
[host.provider.description]
|
||||||
#### ABOUT THE BIND PROPERTY
|
ask.en = "Description"
|
||||||
########################################################################
|
type = "string"
|
||||||
|
bind = "host.description"
|
||||||
|
|
||||||
## (recommended) 'bind' property is a powerful feature that let you
|
# Si vous avez du mal à remplir les champs précédents, ce tableau pourra vous aider :
|
||||||
## configure how and where the data will be read, validated and written.
|
# NANO PHYSICAL VIRTUAL SHARED CLOUD
|
||||||
|
# HOME pm pm vm shared cloud
|
||||||
|
# HOSTEDBAY pm pm vm shared cloud
|
||||||
|
# HOSTEDSERVER -- pm vm shared cloud
|
||||||
|
# OUTSOURCED -- -- vps shared cloud
|
||||||
|
# Légendes : pm : physical machine ; vm : virtual machine ; vps : virtual private server.
|
||||||
|
|
||||||
## By default, 'bind property is in "settings" mode, it means it will
|
[host.provider.type]
|
||||||
## **only** read and write the value in application settings file.
|
ask.en = "Type d'hébergement"
|
||||||
## bind = "settings"
|
type = "string"
|
||||||
|
choices.HOME = "hébergement à domicile"
|
||||||
|
choices.HOSTEDBAY = "serveur personnel hébergé dans une baie d'un fournisseur"
|
||||||
|
choices.HOSTEDSERVER = "serveur d'un fournisseur"
|
||||||
|
choices.OUTSOURCED = "infrastructure totalement sous-traitée"
|
||||||
|
bind = "host.provider.type"
|
||||||
|
|
||||||
## However, settings usually correspond to key/values in actual app configurations
|
[host.provider.hypervisor]
|
||||||
## Hence, a more useful mode is to have bind = ":FILENAME". In that case, YunoHost
|
ask.en = "Nom de l'hyperviseur"
|
||||||
## will automagically find a line with "KEY=VALUE" in FILENAME
|
help.en = ""
|
||||||
## (with the adequate separator between KEY and VALUE)
|
type = "string"
|
||||||
##
|
optional = true
|
||||||
## YunoHost will then use this value for the read/get operation.
|
bind = "host.provider.hypervisor"
|
||||||
## During write/set operations, YunoHost will overwrite the value
|
|
||||||
## in **both** FILENAME and in the app's settings.yml
|
|
||||||
|
|
||||||
## Configuration file format supported: yaml, toml, json, ini, env, php,
|
[host.provider.country-name]
|
||||||
## python. The feature probably works with others formats, but should be tested carefully.
|
ask.en = "Pays"
|
||||||
|
help.en = ""
|
||||||
|
type = "string"
|
||||||
|
bind = "host.country.name"
|
||||||
|
|
||||||
## Note that this feature only works with relatively simple cases
|
[host.provider.country-code]
|
||||||
## such as `KEY: VALUE`, but won't properly work with
|
ask.en = "Code Pays"
|
||||||
## complex data structures like multilin array/lists or dictionnaries.
|
help = "Table ISO 3166-1 alpha-2 : https://fr.wikipedia.org/wiki/ISO_3166-1#Table_de_codage"
|
||||||
## It also doesn't work with XML format, custom config function call, php define(), ...
|
type = "string"
|
||||||
|
bind = "host.country.code"
|
||||||
|
default = "FR"
|
||||||
|
|
||||||
## More info on TODO
|
[host.server.type]
|
||||||
# bind = ":/var/www/__APP__/settings.py"
|
ask.en = "Type de serveur"
|
||||||
|
type = "string"
|
||||||
|
choices.NANO = "nano-ordinateur (Raspberry Pi, Olimex…)"
|
||||||
|
choices.PHYSICAL = "machine physique"
|
||||||
|
choices.VIRTUAL = "machine virtuelle"
|
||||||
|
choices.SHARED = "hébergement mutualisé"
|
||||||
|
choices.CLOUD = "infrastructure multi-serveurs"
|
||||||
|
bind = "host.server.type"
|
||||||
|
|
||||||
|
[__APP__]
|
||||||
|
[__APP__.service]
|
||||||
|
|
||||||
## By default, bind = ":FILENAME" will use the question ID as KEY
|
[__APP__.service.published]
|
||||||
## ... but the question ID may sometime not be the exact KEY name in the configuration file.
|
ask.en = "Publié"
|
||||||
##
|
help.en = "Faut-il publier la fiche descriptive (.properties) du service ?"
|
||||||
## In particular, in pepettes, the python variable is 'name' and not 'project_name'
|
type = "boolean"
|
||||||
## (c.f. https://github.com/YunoHost-Apps/pepettes_ynh/blob/5cc2d3ffd6529cc7356ff93af92dbb6785c3ab9a/conf/settings.py##L11 )
|
|
||||||
##
|
|
||||||
## In that case, the key name can be specified before the column ':'
|
|
||||||
|
|
||||||
bind = "name:/var/www/__APP__/settings.py"
|
[__APP__.service.startdate]
|
||||||
|
ask.en = "Date d'ouverture"
|
||||||
|
type = "date"
|
||||||
|
bind = "service.startdate"
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
## ---------------------------------------------------------------------
|
[__APP__.service.enddate]
|
||||||
## IMPORTANT: other 'bind' mode exists:
|
ask.en = "Date de fermeture"
|
||||||
##
|
type = "date"
|
||||||
## bind = "FILENAME" (with no column character before FILENAME)
|
optional = true
|
||||||
## may be used to bind to the **entire file content** (instead of a single KEY/VALUE)
|
bind = "service.enddate"
|
||||||
## This could be used to expose an entire configuration file, or binary files such as images
|
visible = "__APP__.service.published"
|
||||||
## For example:
|
|
||||||
## bind = "/var/www/__APP__/img/logo.png"
|
|
||||||
##
|
|
||||||
## bind = "null" can be used to disable reading / writing in settings.
|
|
||||||
## This creates sort of a "virtual" or "ephemeral" question which is not related to any actual setting
|
|
||||||
## In this mode, you are expected to define custom getter/setters/validators in scripts/config:
|
|
||||||
##
|
|
||||||
## getter: get__QUESTIONID()
|
|
||||||
## setter: set__QUESTIONID()
|
|
||||||
## validator: validate__QUESTIONID()
|
|
||||||
##
|
|
||||||
## You can also specify a common getter / setter / validator, with the
|
|
||||||
## function 'bind' mode, for example here it will try to run
|
|
||||||
## get__array_settings() first.
|
|
||||||
# bind = "array_settings()"
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
## ---------------------------------------------------------------------
|
[__APP__.service.description]
|
||||||
## IMPORTANT: with the exception of bind=null questions,
|
ask.en = "Description"
|
||||||
## question IDs should almost **always** correspond to an app setting
|
type = "string"
|
||||||
## initialized / reused during install/upgrade.
|
bind = "service.description"
|
||||||
## Not doing so may result in inconsistencies between the config panel mechanism
|
visible = "__APP__.service.published"
|
||||||
## and the use of ynh_add_config
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
########################################################################
|
[__APP__.service.logo]
|
||||||
#### OTHER GENERIC PROPERTY FOR QUESTIONS
|
ask.en = "Logo"
|
||||||
########################################################################
|
|
||||||
|
|
||||||
## (optional) An help text for the question
|
|
||||||
help = "Fill the name of the project which will received donation"
|
|
||||||
|
|
||||||
## (optional) An example display as placeholder in web form
|
|
||||||
# example = "YunoHost"
|
|
||||||
|
|
||||||
## (optional) set to true in order to redact the value in operation logs
|
|
||||||
# redact = false
|
|
||||||
|
|
||||||
## (optional) for boolean questions you can specify replacement values
|
|
||||||
## bound to true and false, in case property is bound to config file
|
|
||||||
# useful if bound property in config file expects something else than integer 1
|
|
||||||
yes = "Enable"
|
|
||||||
# useful if bound property in config file expects something else than integer 0
|
|
||||||
no = "Disable"
|
|
||||||
|
|
||||||
## (optional) A validation pattern
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
## IMPORTANT: your pattern should be between simple quote, not double.
|
|
||||||
## ---------------------------------------------------------------------
|
|
||||||
pattern.regexp = '^\w{3,30}$'
|
|
||||||
pattern.error = "The name should be at least 3 chars and less than 30 chars. Alphanumeric chars are accepted"
|
|
||||||
|
|
||||||
## Note: visible and optional properties are also available for questions
|
|
||||||
|
|
||||||
|
|
||||||
[main.customization.contact_url]
|
|
||||||
ask = "Contact url"
|
|
||||||
type = "url"
|
type = "url"
|
||||||
example = "mailto: contact@example.org"
|
bind = "service.logo"
|
||||||
help = "mailto: accepted"
|
visible = "__APP__.service.published"
|
||||||
pattern.regexp = '^mailto:[^@]+@[^@]+|https://$'
|
|
||||||
pattern.error = "Should be https or mailto:"
|
|
||||||
bind = ":/var/www/__APP__/settings.py"
|
|
||||||
|
|
||||||
[main.customization.logo]
|
[__APP__.service.legal-url]
|
||||||
ask = "Logo"
|
ask.en = "Mentions légales"
|
||||||
type = "file"
|
type = "url"
|
||||||
accept = ".png"
|
bind = "service.legal.url"
|
||||||
help = "Fill with an already resized logo"
|
visible = "__APP__.service.published"
|
||||||
bind = "__INSTALL_DIR__/img/logo.png"
|
|
||||||
|
|
||||||
[main.customization.favicon]
|
[__APP__.service.guide-technical]
|
||||||
ask = "Favicon"
|
ask.en = "Documentation technique"
|
||||||
type = "file"
|
type = "url"
|
||||||
accept = ".png"
|
bind = "service.guide.technical"
|
||||||
help = "Fill with an already sized favicon"
|
visible = "__APP__.service.published"
|
||||||
bind = "__INSTALL_DIR__/img/favicon.png"
|
|
||||||
|
|
||||||
|
[__APP__.service.guide-user]
|
||||||
|
ask.en = "Documentation utilisateurices"
|
||||||
|
type = "url"
|
||||||
|
bind = "service.guide.user"
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
[main.stripe]
|
[__APP__.service.contact-url]
|
||||||
name = "Stripe general info"
|
ask.en = "Page de support"
|
||||||
optional = false
|
type = "url"
|
||||||
|
bind = "service.contact.url"
|
||||||
|
optional = true
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
# The next alert is overwrited with a getter from the config script
|
[__APP__.service.contact-email]
|
||||||
[main.stripe.amount]
|
ask.en = "Courriel de support"
|
||||||
ask = "Donation in the month : XX €
|
type = "email"
|
||||||
type = "alert"
|
bind = "service.contact.email"
|
||||||
style = "success"
|
optional = true
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
[main.stripe.publishable_key]
|
[__APP__.service.registration]
|
||||||
ask = "Publishable key"
|
ask.en = "Inscription"
|
||||||
type = "string"
|
type = "string"
|
||||||
redact = true
|
choices.None = "Le service s'utilise sans inscription"
|
||||||
help = "Indicate here the stripe publishable key"
|
choices.Free = "Inscription nécessaire mais ouverte à tout le monde et gratuite"
|
||||||
bind = ":/var/www/__APP__/settings.py"
|
choices.Member = "Inscription restreinte aux membres (la notion de membre pouvant être très relative, par exemple, une famille, un cercle d’amis, adhérents d'association…)"
|
||||||
|
choices.Client = "Inscription liée à une relation commerciale (facture…)"
|
||||||
|
bind = "service.registration"
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
[main.stripe.secret_key]
|
[__APP__.service.registration-load]
|
||||||
ask = "Secret key"
|
ask.en = "Capacité"
|
||||||
type = "string"
|
type = "string"
|
||||||
redact = true
|
choices.OPEN = "Le service accueille de nouveaux comptes"
|
||||||
help = "Indicate here the stripe secret key"
|
choices.FULL = "Le service n'accueille plus de nouveau compte pour l'instant"
|
||||||
bind = ":/var/www/__APP__/settings.py"
|
bind = "service.registration.load"
|
||||||
|
visible = "__APP__.service.published"
|
||||||
|
|
||||||
[main.stripe.prices]
|
|
||||||
ask = "Prices ID"
|
|
||||||
type = "tags"
|
|
||||||
help = """\
|
|
||||||
Indicates here the prices ID of donation products you created in stripe interfaces. \
|
|
||||||
Go on [Stripe products](https://dashboard.stripe.com/products) to create those donation products. \
|
|
||||||
Fill it tag with 'FREQUENCY/CURRENCY/PRICE_ID' \
|
|
||||||
FREQUENCY: 'one_time' or 'recuring' \
|
|
||||||
CURRENCY: 'EUR' or 'USD' \
|
|
||||||
PRICE_ID: ID from stripe interfaces starting with 'price_' \
|
|
||||||
"""
|
|
||||||
pattern.regexp = '^(one_time|recuring)/(EUR|USD)/price_.*$'
|
|
||||||
pattern.error = "Please respect the format describe in help text for each price ID"
|
|
||||||
|
|
|
@ -1,105 +1,313 @@
|
||||||
|
|
||||||
## 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"
|
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]
|
[main]
|
||||||
|
|
||||||
## Define the label for your panel
|
services = []
|
||||||
## Internationalization works similarly to the 'description' and 'ask' questions in the manifest
|
|
||||||
# name.en = "Main configuration"
|
|
||||||
# name.fr = "Configuration principale"
|
|
||||||
|
|
||||||
## (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__"]
|
|
||||||
# or services = ["nginx", "__APP__"] to also reload-or-restart nginx
|
|
||||||
|
|
||||||
## (optional) This help properties is a short help displayed on the same line
|
## (optional) This help properties is a short help displayed on the same line
|
||||||
## than the panel title but not displayed in the tab.
|
## than the panel title but not displayed in the tab.
|
||||||
# help = ""
|
# help = ""
|
||||||
|
|
||||||
############################################################################
|
[main.organization]
|
||||||
#### 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.customization]
|
|
||||||
|
|
||||||
## (optional) Defining a proper title for sections is not mandatory
|
|
||||||
## and depends on the exact rendering you're aiming for the CLI / webadmin
|
|
||||||
name = ""
|
name = ""
|
||||||
|
|
||||||
## (optional) This help properties is a short help displayed on the same line
|
|
||||||
## than the section title, meant to provide additional details
|
|
||||||
# help = ""
|
# help = ""
|
||||||
|
|
||||||
## (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 = false
|
|
||||||
|
|
||||||
## (optional) It's also possible with the 'visible' property to only
|
# [Organisation]
|
||||||
## display the section depending on the user's answers to previous questions.
|
# Nom de l'organisation (type STRING, obligatoire, ex. LibreServiceEU).
|
||||||
##
|
[main.organization.name]
|
||||||
## Be careful that the 'visible' property should only refer to **previous** questions
|
ask.en = "Nom de l'oganisation"
|
||||||
## Hence, it should not make sense to have a "visible" property on the very first section.
|
type = "string"
|
||||||
##
|
bind = "organization.name>/var/www/__APP__/public/organization.properties"
|
||||||
## 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)
|
# Description de l'organisation (type STRING, recommandé, ex. LibreServiceEU est le chaton de Devinsy).
|
||||||
# visible = true
|
[main.organization.description]
|
||||||
|
ask.en = "Description de l'organisation"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.description"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.status-level]
|
||||||
|
ask.en = "Statut"
|
||||||
|
type = "string"
|
||||||
|
choices.ACTIVE = "Actif"
|
||||||
|
choices.IDLE = "En pause"
|
||||||
|
choices.AWAY = "Inactif"
|
||||||
|
bind = "organization.status.level"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.status-description]
|
||||||
|
ask.en = "Description du statut"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.status.description"
|
||||||
|
optional = true
|
||||||
|
visible = "status-level == 'IDLE'"
|
||||||
|
|
||||||
|
[main.organization.startdate]
|
||||||
|
ask.en = "Date de création"
|
||||||
|
type = "date"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.enddate]
|
||||||
|
ask.en = "Date de fermeture"
|
||||||
|
type = "date"
|
||||||
|
optional = true
|
||||||
|
visible = "status-level == 'AWAY'"
|
||||||
|
|
||||||
|
|
||||||
|
[main.organization.type]
|
||||||
|
ask.en = "Type d'organisation"
|
||||||
|
type = "string"
|
||||||
|
choices.ASSOCIATION = "Association"
|
||||||
|
choices.INFORMAL = "Informel"
|
||||||
|
choices.COOPERATIVE = "Coopérative"
|
||||||
|
choices.MICROCOMPANY = "Micro entreprise"
|
||||||
|
choices.COMPANY = "Société"
|
||||||
|
choices.INDIVIDUAL = "Individue"
|
||||||
|
choices.OTHER = "Autre"
|
||||||
|
bind = "organization.type"
|
||||||
|
|
||||||
|
|
||||||
|
[main.organization.website]
|
||||||
|
ask.en = "Siteweb"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.website"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
|
||||||
|
[main.organization.logo]
|
||||||
|
ask.en = "Name of the project"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.logo"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.contact-url]
|
||||||
|
ask.en = "URL de contact"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.contact.url"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.contact-mail]
|
||||||
|
ask.en = "Mail de contact"
|
||||||
|
type = "email"
|
||||||
|
bind = "organization.contact.email"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.legal-url]
|
||||||
|
ask.en = "Mentions légales"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.legal.url"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.guide-technical]
|
||||||
|
ask.en = "Documentation technique"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.guide.technical"
|
||||||
|
default = "https://yunohost.org/admindoc"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.guide-user]
|
||||||
|
ask.en = "Documentation utilisateurice"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.guide.user"
|
||||||
|
default = "https://yunohost.org/user_guide"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.organization.status-level-chatons]
|
||||||
|
ask.en = "Statut"
|
||||||
|
type = "string"
|
||||||
|
choices.ACTIVE = "Actif"
|
||||||
|
choices.IDLE = "En pause"
|
||||||
|
choices.AWAY = "Inactif"
|
||||||
|
bind = "organization.memberof.chatons.status.level"
|
||||||
|
|
||||||
|
[main.organization.status-description]
|
||||||
|
ask.en = "Description du statut"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.memberof.chatons.status.description"
|
||||||
|
optional = true
|
||||||
|
visible = "status-level-chatons == 'IDLE'"
|
||||||
|
|
||||||
|
[main.organization.startdate-chatons]
|
||||||
|
ask.en = "Date d'entrée dans le collectif"
|
||||||
|
type = "date"
|
||||||
|
bind = "organization.memberof.chatons.startdate"
|
||||||
|
|
||||||
|
[main.organization.enddate-chatons]
|
||||||
|
ask.en = "Date de sortie du collectif"
|
||||||
|
type = "date"
|
||||||
|
optional = true
|
||||||
|
visible = "status-level-chatons == 'AWAY'"
|
||||||
|
bind = "organization.memberof.chatons.enddate"
|
||||||
|
|
||||||
|
[main.owner]
|
||||||
|
name = "Propriétaire de l'organisation"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.owner.owner-name]
|
||||||
|
ask.en = "Nom"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.owner.name"
|
||||||
|
[main.owner.owner-website]
|
||||||
|
ask.en = "siteweb"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.owner.website"
|
||||||
|
[main.owner.owner-logo]
|
||||||
|
ask.en = "Logo"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.owner.logo"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[main.location]
|
||||||
|
name = "Localisation de l'organisation"
|
||||||
|
# help = ""
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.location.country-name]
|
||||||
|
ask.en = "Pays de l'organisation"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.country.name"
|
||||||
|
optional = false
|
||||||
|
|
||||||
|
[main.location.country-code]
|
||||||
|
ask.en = "Code pays de l'organisation"
|
||||||
|
help = "Table ISO 3166-1 alpha-2 : https://fr.wikipedia.org/wiki/ISO_3166-1#Table_de_codage"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.country.code"
|
||||||
|
default = "FR"
|
||||||
|
|
||||||
|
# Latitude (type DECIMAL_DEGREE, recommandé, format DD, ex. 15,23456).
|
||||||
|
[main.location.latitude]
|
||||||
|
ask.en = "Latitude"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.geolocation.latitude"
|
||||||
|
[main.location.longitude]
|
||||||
|
ask.en = "Longitude"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.geolocation.longitude"
|
||||||
|
|
||||||
|
[main.location.address]
|
||||||
|
ask.en = "Adresse"
|
||||||
|
type = "string"
|
||||||
|
bind = "organization.geolocation.address"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[main.socialnetworks]
|
||||||
|
name = "Réseaux sociaux"
|
||||||
|
help = "Liens vers les comptes réseaux sociaux de l'organisation"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.socialnetworks.diaspora]
|
||||||
|
ask.en = "Diaspora"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.diaspora"
|
||||||
|
[main.socialnetworks.facebook]
|
||||||
|
ask.en = "Facebook"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.facebook"
|
||||||
|
[main.socialnetworks.funkwhale]
|
||||||
|
ask.en = "Funkwhale"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.funkwhale"
|
||||||
|
[main.socialnetworks.mastodon]
|
||||||
|
ask.en = "Mastodon"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.mastodon"
|
||||||
|
[main.socialnetworks.pleroma]
|
||||||
|
ask.en = "Pleroma"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.pleroma"
|
||||||
|
[main.socialnetworks.mobilizon]
|
||||||
|
ask.en = "Mobilizon"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.mobilizon"
|
||||||
|
[main.socialnetworks.peertube]
|
||||||
|
ask.en = "Peertube"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.peertube"
|
||||||
|
[main.socialnetworks.pixelfed]
|
||||||
|
ask.en = "Pixelfed"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.pixelfed"
|
||||||
|
[main.socialnetworks.twitter]
|
||||||
|
ask.en = "Twitter"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.socialnetworks.twitter"
|
||||||
|
|
||||||
|
[main.chatrooms]
|
||||||
|
name = "Salons de discussion"
|
||||||
|
help = "Adresse vers les salons/équipes de discussion publics de l'organisation"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[main.chatrooms.xmpp]
|
||||||
|
ask.en = "XMPP"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.chatrooms.xmpp"
|
||||||
|
[main.chatrooms.irc]
|
||||||
|
ask.en = "IRC"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.chatrooms.irc"
|
||||||
|
[main.chatrooms.matrix]
|
||||||
|
ask.en = "Matrix"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.chatrooms.matrix"
|
||||||
|
[main.chatrooms.rocketchat]
|
||||||
|
ask.en = "RocketChat"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.chatrooms.rocketchat"
|
||||||
|
[main.chatrooms.mattermost]
|
||||||
|
ask.en = "Mattermost"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.chatrooms.mattermost"
|
||||||
|
|
||||||
|
|
||||||
|
[main.funding]
|
||||||
|
name = "Dons"
|
||||||
|
help = "Services de paiement permettant de récolter des donations pour votre chaton"
|
||||||
|
optional = true
|
||||||
|
# Liens vers les services de paiement permettant de récolter des donations pour votre chaton (type URL, optionnel).
|
||||||
|
# Dans le cas d'une solution maison (exemple : pont vers votre banque), choisir "organization.funding.custom".
|
||||||
|
# Liste non exhaustive à laquelle vous pouvez ajouter d'autres services.
|
||||||
|
[main.funding.liberapay]
|
||||||
|
ask.en = "Liberapay"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.funding.liberapay"
|
||||||
|
[main.funding.tipee]
|
||||||
|
ask.en = "Tipee"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.funding.Tipee"
|
||||||
|
[main.funding.helloasso]
|
||||||
|
ask.en = "Helloasso"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.funding.helloasso"
|
||||||
|
[main.funding.paypal]
|
||||||
|
ask.en = "Paypal"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.funding.paypal"
|
||||||
|
[main.funding.custom]
|
||||||
|
ask.en = "Custom"
|
||||||
|
type = "url"
|
||||||
|
bind = "organization.funding.custom"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#### ABOUT QUESTIONS
|
#### ABOUT QUESTIONS
|
||||||
|
|
|
@ -47,4 +47,4 @@ disk = "50M"
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
# This will create/remove the install dir as /var/www/$app
|
# This will create/remove the install dir as /var/www/$app
|
||||||
# and store the corresponding setting $install_dir
|
# and store the corresponding setting $install_dir
|
||||||
dir = "/var/www/__APP__/sources/"
|
dir = "/var/www/__APP__/"
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
rewrite_config_panel() {
|
||||||
|
export apps=$(yunohost app list | grep "id\:" | sed "s/ id: //g")
|
||||||
|
ynh_render_template /etc/yunohost/apps/chatonsinfo/config_panel.toml.j2 /etc/yunohost/apps/chatonsinfo/config_panel.toml
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
|
|
|
@ -34,26 +34,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,42 +21,12 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
### `ynh_setup_source` use the file conf/app.src
|
### `ynh_setup_source` use the file conf/app.src
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir/sources"
|
||||||
|
mkdir $install_dir/public
|
||||||
# $install_dir will automatically be initialized with some decent
|
# $install_dir will automatically be initialized with some decent
|
||||||
# permission by default ... however, you may need to recursively reapply
|
# permission by default ... however, you may need to recursively reapply
|
||||||
# ownership to all files such as after the ynh_setup_source step
|
# ownership to all files such as after the ynh_setup_source step
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir/public"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SYSTEM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
### `yunohost service add` integrates a service in YunoHost. It then gets
|
|
||||||
### displayed in the admin interface and through the others `yunohost service` commands.
|
|
||||||
### (N.B.: this line only makes sense if the app adds a service to the system!)
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove these files in conf/.
|
|
||||||
### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script
|
|
||||||
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
|
|
||||||
### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
|
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
|
||||||
### Use this helper only if there is effectively a log file for this app.
|
|
||||||
### If you're not using this helper:
|
|
||||||
### - Remove the section "BACKUP LOGROTATE" in the backup script
|
|
||||||
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
|
|
||||||
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
|
|
||||||
### - And the section "SETUP LOGROTATE" in the upgrade script
|
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
|
||||||
ynh_use_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# APP INITIAL CONFIGURATION
|
# APP INITIAL CONFIGURATION
|
||||||
|
@ -65,50 +35,13 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
### You can add specific configuration files.
|
cp "$install_dir/sources/organization.properties" "$install_dir/public/"
|
||||||
###
|
|
||||||
### Typically, put your template conf file in ../conf/your_config_file
|
|
||||||
### The template may contain strings such as __FOO__ or __FOO_BAR__,
|
|
||||||
### which will automatically be replaced by the values of $foo and $foo_bar
|
|
||||||
###
|
|
||||||
### ynh_add_config will also keep track of the config file's checksum,
|
|
||||||
### which later during upgrade may allow to automatically backup the config file
|
|
||||||
### if it's found that the file was manually modified
|
|
||||||
###
|
|
||||||
### Check the documentation of `ynh_add_config` for more info.
|
|
||||||
|
|
||||||
ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file"
|
chown -R $app:www-data"$install_dir/public"
|
||||||
|
|
||||||
# FIXME: this should be handled by the core in the future
|
|
||||||
# You may need to use chmod 600 instead of 400,
|
|
||||||
# for example if the app is expected to be able to modify its own config
|
|
||||||
chmod 400 "$install_dir/some_config_file"
|
|
||||||
chown $app:$app "$install_dir/some_config_file"
|
|
||||||
|
|
||||||
### For more complex cases where you want to replace stuff using regexes,
|
|
||||||
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
|
|
||||||
### When doing so, you also need to manually call ynh_store_file_checksum
|
|
||||||
###
|
|
||||||
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file"
|
|
||||||
### ynh_store_file_checksum --file="$install_dir/some_config_file"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
||||||
|
|
||||||
### `ynh_systemd_action` is used to start a systemd service for an app.
|
|
||||||
### Only needed if you have configure a systemd service
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
|
|
||||||
### - As well as the section "START SYSTEMD SERVICE" in the restore script
|
|
||||||
### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
|
|
||||||
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
|
||||||
|
|
||||||
# Start a systemd service
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,49 +9,10 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Settings are automatically loaded as bash variables
|
|
||||||
# in every app script context, therefore typically these will exist:
|
|
||||||
# - $domain
|
|
||||||
# - $path
|
|
||||||
# - $language
|
|
||||||
# - $install_dir
|
|
||||||
# - $port
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# For remove operations :
|
|
||||||
# - the core will deprovision every resource defined in the manifest **after** this script is ran
|
|
||||||
# this includes removing the install directory, and data directory (if --purge was used)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
|
||||||
|
|
||||||
# This should be a symetric version of what happens in the install script
|
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
|
||||||
yunohost service remove $app
|
|
||||||
fi
|
|
||||||
|
|
||||||
ynh_remove_systemd_config
|
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
ynh_remove_logrotate
|
|
||||||
|
|
||||||
# Remove other various files specific to the app... such as :
|
|
||||||
|
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_secure_remove --file="/etc/$app"
|
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -32,18 +32,7 @@ ynh_script_progression --message="Restoring system configurations related to $ap
|
||||||
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
||||||
systemctl enable $app.service --quiet
|
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
# Other various files...
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
ynh_restore_file --origin_path="/etc/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -52,10 +41,6 @@ ynh_restore_file --origin_path="/etc/$app/"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
|
|
||||||
# Typically you only have either $app or php-fpm but not both at the same time...
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue