<a id="hsl-plugins"></a>

# HSL plugins

Plugins written in HSL should be installed inside a per-plugin folder inside of [`environment.pluginspath`](config_startup.html.md#confval-environment.pluginspath)`/hsl/example`.

```c
/opt/halon/plugins/hsl/
/opt/halon/plugins/hsl/example
/opt/halon/plugins/hsl/example/main.hsl
/opt/halon/plugins/hsl/example/example.hsl
```

A suggestive structure is to have a `main.hsl` file which imports (hence export) what should be availabe to the user of the plugin.

```javascript
import { hello } from "./example.hsl";
```

```javascript
function hello()
{
        return "world";
}
```

The user of the plugin would import it using

```javascript
import { hello } from "extras://example";

echo hello(); // "world"
```

If the plugin example.hsl need access to plugin config [`plugins[].config`](config_startup.html.md#confval-plugins-.config).
It can access the configuration using the following imports.
It allows you to build app that consumes the same configuration as native plugins.

```javascript
import $smtpd from "plugin-config://smtpd.yaml";
import $smtpdapp from "plugin-config://smtpd-app.yaml";
```
