2.6 KiB
Helpers
It's recommended to use helpers.
Shell
From YunoHost 2.4, shell helpers are available.
To use them, you need to add following lines in the shell scripts:
# Source app helpers
. /usr/share/yunohost/apps/helpers
Moulinette
The CLI moulinette provides a few tools to make the packager's work easier:
sudo yunohost app checkport <port>
This helper checks the port and returns an error if the port is already in use.
sudo yunohost app setting <id> <key> [ -v <value> ]
This is the most important helper of YunoHost. It allows you to store some settings for a specific app, in order to be either reused afterward or used for YunoHost configuration (**e.g.** for the SSO).
It sets the value if you append ```-v ```, and gets it otherwise.
** Some useful settings **
skipped_uris
Remove the protection on the uris list provided separated by commas.
protected_uris
Protects the uris list provided separated by commas. Only logged in users will have access.There are also
skipped_regex
,protected_regex
,unprotected_uris
,unprotected_regex
.Be careful : you must run
yunohost app ssowatconf
to apply the effect. URIs will be converted into URLs and written to the file /etc/ssowat/conf.json.Example:
yunohost app setting myapp unprotected_urls -v "/"
yunohost app ssowatconf
These commands will disable the SSO on the root of the aplication like domain.tld/myapp This is useful for public application.
sudo yunohost app checkurl <domain><path> -a <id>
This helper is useful for web apps and allows you to be sure that the web path is not taken by another app. If not, it "reserves" the path.
**Note**: do not prepend `http://` or `https://` to the ``.
sudo yunohost app initdb <db_user> [ -p <db_pwd> ] [ -s <SQL_file> ]
This helper creates a MySQL database. If you do not append a password, it generates one and returns it. If you append a SQL file, it initializes your database with the SQL statements inside.
sudo yunohost app ssowatconf
This helper reloads the SSO configuration. You have to call it at the end of the script when you are packaging a web app.