The HSL editor functions as an IDE for Halon's domain-specific scripting language, and provides features to both test and deploy code.
First and foremost, it allows you to quickly browse and edit (diff, verify and save) the configuration; scripts (such as RCPT TO, pre-delivery, etc) and include files. Secondly, it allows you to run arbitrary code (or actual scripts, with the use of context-specific pre/postamble code) in the HSL interpreter hsh.
The script listing panel list all contexts and scripts available. It also includes some script examples. Some scripts are marked with an exclamation mark, this means you will not be able to open them for editing until converted into a single code block (This is done on the Mail > Flows and Script > edit page).
- Search: Open the "Search" panel, which can be used to search across all scripts and files.
- Add scratchpad: Create a temporary script.
- Add: Create new scripts and include files.
There is one editor windows for each script. Each script is opened independently of each other, and one script does not see changes done in another script (eg. using include) until that script is saved.
- Save: Save the script to the running configuration. It will also perform syntax checks, any error found may be overridden and saved anyway, however that is not recommended. If you receive a error while saving, please consult Halon's support team.
- Show changes: Show changes made in the script in regards to the current running configuration.
- Test: Run syntax checks and will show the output in the console.
- Run in sandbox: Execute the code in a "core language" sandbox (with the pre-/postamble script attached). The pre-/postamble script contains some of the variables and functions needed to simulate the context. Note that all function in the "core language" will be executed (that includes eg. http() calls). In order to setup a working environment uncomment and set the correct value for each variable.
- Edit as CSV: Some files may have the type of text/csv, and can be edited in the CSV editor. It supports adding/removing columns, adding/removing rows, and reordering of columns and rows. Other operations (such as search and replace) may be performed in the text editor view.
The console panel shows all messages generated by the editor. If the console is minimized it will show a badge with the number of log messages unread.
The search panel searches in all code (currently saved on the server side) and shows the line with a surround context of each match.
CSV is a simple format to store tabular data, which can be useful with functions such as csv_decode(). You can either create a new CSV file using the File listing's Add button, or change an existing plain text file to the text/csv type by pressing the Editor's Edit as CSV button. Please keep in mind that a conversion between text and CSV happens each time you press the button. The CSV editor supports adding, removing and swapping columns and rows, as well as sorting rows. Search and replace can be performed while in non-CSV mode.
Article is closed for comments.