Doc auto-generated by this script on 13/11/2024 (YunoHost version 12.0.7)
You may encounter some named types which are used for simplicity.
Translation
: a translated property
ask
, help
and Pattern.error
dict
with locales as keys and translations as values:
ask.en = "The text in english"
ask.fr = "Le texte en français"
It is not currently possible for translators to translate those string in weblate.
str
for a single english default string
help = "The text in english"
JSExpression
: a str
JS expression to be evaluated to true
or false
:
visible
and enabled
==
, !=
, >
, >=
, <
, <=
, !
, &&
, ||
, +
, -
, *
, /
, %
and match()
Binding
: bind a value to a file/property/variable/getter/setter/validator
settings.yaml
when not defined"null"
"null"
+ a function starting with get__
, set__
, validate__
in scripts/config
:__FINALPATH__/my_file.php
__FINALPATH__/my_file.php
Pattern
: a dict
with a regex to match the value against and an error message
pattern.regexp = '^[A-F]\d\d$'
pattern.error = "Provide a room number such as F12: one uppercase and 2 numbers"
# or with translated error
pattern.error.en = "Provide a room number such as F12: one uppercase and 2 numbers"
pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres."
pattern.regexp
should be between simple quote, not double.This is the 'root' level of the config panel toml file
version = 1.0
[config]
# …refer to Panels doc
version
: float
(default: 1.0
), version that the config panel supports in terms of features.i18n
(optional): str
, an i18n property that let you internationalize options text.
yunohost domain config
), prefer the use Translation
in name
, help
, etc.Panels are, basically, sections grouped together. Panels are dict
s defined inside a ConfigPanel file and require a unique id (in the below example, the id is main
). Keep in mind that this id will be used in CLI to refer to the panel, so choose something short and meaningfull.
[main]
name.en = "Main configuration"
name.fr = "Configuration principale"
help = ""
services = ["__APP__", "nginx"]
[main.customization]
# …refer to Sections doc
name
: Translation
or str
, displayed as the panel titlehelp
(optional): Translation
or str
, text to display before the first sectionservices
(optional): list
of services names to reload-or-restart
when any option's value contained in the panel changes
"__APP__
will refer to the app instance nameactions
: FIXME not sure what this doesSections are, basically, options grouped together. Sections are dict
s defined inside a Panel and require a unique id (in the below example, the id is customization
prepended by the panel's id main
). Keep in mind that this combined id will be used in CLI to refer to the section, so choose something short and meaningfull. Also make sure to not make a typo in the panel id, which would implicitly create an other entire panel.
If at least one button
is present it then become an action section.
Options in action sections are not considered settings and therefor are not saved, they are more like parameters that exists only during the execution of an action.
FIXME i'm not sure we have this in code.
[main]
[main.customization]
name.en = "Advanced configuration"
name.fr = "Configuration avancée"
help = "Every form items in this section are not saved."
services = ["__APP__", "nginx"]
[main.customization.option_id]
type = "string"
# …refer to Options doc
name
(optional): Translation
or str
, displayed as the section's title if anyhelp
: Translation
or str
, text to display before the first optionservices
(optional): list
of services names to reload-or-restart
when any option's value contained in the section changes
"__APP__
will refer to the app instance nameoptional
: bool
(default: true
), set the default optional
prop of all Options in the sectionvisible
: bool
or JSExpression
(default: true
), allow to conditionally display a section depending on user's answers to previous questions.
visible
property should only refer to previous options's value. Hence, it should not make sense to have a visible
property on the very first section.Options are fields declaration that renders as form items, button, alert or text in the web-admin and printed or prompted in CLI. They are used in app manifests to declare the before installation form and in config panels.
Have a look at the app config panel doc for details about Panels and Sections.
IMPORTANT: as for Panels and Sections 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.
[section.my_option_id]
type = "string"
# ask as `str`
ask = "The text in english"
# ask as `dict`
ask.en = "The text in english"
ask.fr = "Le texte en français"
# advanced props
visible = "my_other_option_id != 'success'"
readonly = true
# much advanced: config panel only?
bind = "null"
type
: the actual type of the option, such as 'markdown', 'password', 'number', 'email', ...ask
: Translation
(default to the option's id
if not defined):
help
property to provide additional details if necessary.visible
(optional): bool
or JSExpression
(default: true
)
false
and used alongside readonly = true
, you get a context only value that can still be used in JSExpression
sreadonly
(optional): bool
(default: false
, forced to true
for readonly types):
true
for input types: forbid mutation of its valuebind
(optional): Binding
, config panels only! A powerful feature that let you configure how and where the setting will be read, validated and written
settings.yml
"null"
:
scripts/config
there's a function named:
get__my_option_id
: the value will be gathered from this custom getterset__my_option_id
: the value will be passed to this custom setter where you can do whatever you want with the valuevalidate__my_option_id
: the value will be passed to this custom validator before any custom setterbind
is a file path:
:
, the value be saved as its id's variable/property counterpart
__FINALPATH__
or __INSTALL_DIR__
in your path to point to dynamic install paths
bind
doc for explaination and examplesRest of the option types available are considered inputs
.
[section.my_option_id]
type = "string"
# …any common props… +
optional = false
redact = false
default = "some default string"
help = "You can enter almost anything!"
example = "an example string"
placeholder = "write something…"
optional
: bool
(default: false
, but true
in config panels)redact
: bool
(default: false
), to redact the value in the logs when the value contain private informationdefault
: depends on type
, the default value to assign to the option
default
to assign a value (or return a dynamic default
from a custom getter)help
(optional): Translation
, to display a short help message in cli and web-adminexample
(optional): str
, to display an example value in web-admin onlyplaceholder
(optional): str
, shown in the web-admin fields onlymarkdown
(readonly)Display markdown multi-line content. Markdown is currently only rendered in the web-admin
[section.my_option_id]
type = "display_text"
ask = "Text **rendered** in markdown."
alert
(readonly)Alerts displays a important message with a level of severity.
You can use markdown in ask
but will only be rendered in the web-admin.
[section.my_option_id]
type = "alert"
ask = "The configuration seems to be manually modified..."
style = "warning"
icon = "warning"
style
: any of "success|info|warning|danger"
(default: "info"
)icon
(optional): any icon name from Fork Awesome
button
(readonly)Triggers actions.
Available only in config panels.
Renders as a button
in the web-admin and can be called with yunohost [app|domain|settings] action run <action_id>
in CLI.
Every options defined in an action section (a config panel section with at least one button
) is guaranted to be shown/asked to the user and available in scripts/config
's scope.
check examples in advanced use cases.
[section.my_option_id]
type = "button"
ask = "Break the system"
style = "danger"
icon = "bug"
# enabled only if another option's value (a `boolean` for example) is positive
enabled = "aknowledged"
To be able to trigger an action we have to add a bash function starting with run__
in your scripts/config
run__my_action_id() {
ynh_print_info "Running 'my_action_id' action"
}
bind
: forced to "null"
style
: any of "success|info|warning|danger"
(default: "success"
)enabled
: JSExpression
or bool
(default: true
)
JSExpression
you can enable/disable the button depending on contexticon
(optional): any icon name from Fork Awesome
string
(string)Ask for a simple string.
[section.my_option_id]
type = "string"
default = "E10"
pattern.regexp = '^[A-F]\d\d$'
pattern.error = "Provide a room like F12 : one uppercase and 2 numbers"
default
: ""
pattern
(optional): Pattern
, a regex to match the value againsttext
(string)Ask for a multiline string.
Renders as a textarea
in the web-admin and by opening a text editor on the CLI.
[section.my_option_id]
type = "text"
default = "multi\nline\ncontent"
default
: ""
pattern
(optional): Pattern
, a regex to match the value againstpassword
(input)Ask for a password. The password is tested as a regular user password (at least 8 chars)
[section.my_option_id]
type = "password"
default
: forced to ""
redact
: forced to true
example
: forbiddencolor
(input)Ask for a color represented as a hex value (with possibly an alpha channel).
Renders as color picker in the web-admin and as a prompt that accept named color like yellow
in CLI.
[section.my_option_id]
type = "color"
default = "#ff0"
default
: ""
number
(input)Ask for a number (an integer).
[section.my_option_id]
type = "number"
default = 100
min = 50
max = 200
step = 5
type
: number
or range
(input or slider in the web-admin)min
(optional): minimal int value inclusivemax
(optional): maximal int value inclusivestep
(optional): currently only used in the webadmin as the <input/>
step jumpboolean
(input)Ask for a boolean. Renders as a switch in the web-admin and a yes/no prompt in CLI.
[section.my_option_id]
type = "boolean"
default = 1
yes = "agree"
no = "disagree"
default
: 0
yes
(optional): (default: 1
) define as what the thruthy value should output
true
, True
, "yes"
, etc.no
(optional): (default: 0
) define as what the thruthy value should output
0
, "false"
, "n"
, etc.date
(input)Ask for a date in the form "2025-06-14"
.
Renders as a date-picker in the web-admin and a regular prompt in CLI.
Can also take a timestamp as value that will output as an ISO date string.
[section.my_option_id]
type = "date"
default = "2070-12-31"
default
: ""
time
(input)Ask for an hour in the form "22:35"
.
Renders as a date-picker in the web-admin and a regular prompt in CLI.
[section.my_option_id]
type = "time"
default = "12:26"
default
: ""
email
(input)Ask for an email. Validation made with python-email-validator
[section.my_option_id]
type = "email"
default = "Abc.123@test-example.com"
default
: ""
path
(string)Ask for an web path (the part of an url after the domain). Used by default in app install to define from where the app will be accessible.
[section.my_option_id]
type = "path"
default = "/"
default
: ""
pattern
(optional): Pattern
, a regex to match the value againsturl
(string)Ask for any url.
[section.my_option_id]
type = "url"
default = "https://example.xn--zfr164b/@handle/"
default
: ""
pattern
(optional): Pattern
, a regex to match the value againstfile
(input)Ask for file. Renders a file prompt in the web-admin and ask for a path in CLI.
[section.my_option_id]
type = "file"
accept = ".json"
# bind the file to a location to save the file there
bind = "/tmp/my_file.json"
default
: ""
accept
: a comma separated list of extension to accept like ".conf, .ini
select
(choices)Ask for value from a limited set of values.
Renders as a regular <select/>
in the web-admin and as a regular prompt in CLI with autocompletion of choices
.
[section.my_option_id]
type = "select"
choices = ["one", "two", "three"]
choices = "one,two,three"
default = "two"
default
: ""
, obviously the default has to be empty or an available choices
item.choices
: a (coma separated) list of valuestags
(choices)Ask for series of values. Optionally from a limited set of values.
Renders as a multi select in the web-admin and as a regular prompt in CLI without autocompletion of choices
.
This output as a coma separated list of strings "one,two,three"
[section.my_option_id]
type = "tags"
default = "word,another word"
[my_other_option_id]
type = "tags"
choices = ["one", "two", "three"]
# choices = "one,two,three"
default = "two,three"
default
: ""
, obviously the default has to be empty or an available choices
item.pattern
(optional): Pattern
, a regex to match all the values againstchoices
(optional): a (coma separated) list of valuesicon
(optional): any icon name from Fork Awesome
domain
(choices)Ask for a user domain. Renders as a select in the web-admin and as a regular prompt in CLI with autocompletion of registered domains.
[section.my_option_id]
type = "domain"
default
: forced to the instance main domainapp
(choices)Ask for a user app. Renders as a select in the web-admin and as a regular prompt in CLI with autocompletion of installed apps.
[section.my_option_id]
type = "app"
filter = "is_webapp"
default
: ""
filter
(optional): JSExpression
with what yunohost app info <app_id> --full
returns as context (only first level keys)user
(choices)Ask for a user. Renders as a select in the web-admin and as a regular prompt in CLI with autocompletion of available usernames.
[section.my_option_id]
type = "user"
default
: the first admin user foundgroup
(choices)Ask for a group. Renders as a select in the web-admin and as a regular prompt in CLI with autocompletion of available groups.
[section.my_option_id]
type = "group"
default = "visitors"
default
: "all_users"
, "visitors"
or "admins"
(default: "all_users"
)Нашли ошибки? Думаете, что можете улучшить документацию? Simply click the Edit link at the top of the page, and then the icon on Github to suggest changes.
Powered by Grav + with by Trilby Media. • Terms of Service