Application packaging
### Helpers
It's recommended to use helpers.
#### Shell
From YunoHost 2.4, [shell helpers](https://dev.yunohost.org/projects/yunohost/repository/yunohost/revisions/unstable/show/data/helpers.d) are available.
To use them, you need to add following lines in the shell scripts:
```bash
# Source app helpers
. /usr/share/yunohost/helpers
```
#### Moulinette
The CLI [moulinette](/moulinette) provides a few tools to make the packager's work easier:
```bash
sudo yunohost app checkport
```
This helper checks the port and returns an error if the port is already in use.
```bash
sudo yunohost app setting [ -v ]
```
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.
```bash
sudo yunohost app checkurl -a
```
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 ``.
```bash
sudo yunohost app initdb [ -p ] [ -s ]
```
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.
```bash
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.