1. Home
  2. Balancer
  3. Add Lua Scripts to your balancer

Add Lua Scripts to your balancer

Add new Lua script

New to Snapt Balancer is the ability to create Lua scripts and add them to the Balancer groups. Lua is a powerful, fast, lightweight, embeddable scripting language. That will allow you to accept and deny access. We believe this will be a valuable addition to our product offering.

You can find the Lua scripts in this menu Balancer -> Configuration -> Lua Scripts

Start with a sample Lua script template when you click on Create/Edit Script Tab. Use a name to identify your Lua script under the Add Script Heading

Click on Add Script and a Lua script template will, as a result, get started right away. You can locate the file here /var/snapt/lua/. furthermore, all the Lua scripts are in this folder and visible in your balancer configuration.

All the Lua scripts are under showed Existing scripts. 

Also, you can remove any of them through the click of the Delete Script button.

Load Lua scripts into configuration

The Lua scripts are now ready for you to apply in your configuration. You will need to load the script into your configuration before you can use it. Click on the script and will load and also it show you the contents of that script in the editor block. Finally, click on Load Script to add it into your configuration. As a result, you will now find the Lua script available to select in the Access Control of the Balancer group.

Click on the Edit button from the group list of the item you want to apply the Lua script. Under “Access Control” you will find your loaded scripts. Finally select the script on this group and it will load first to determine if the contents will return.

Save the changes by clicking the Save button and restarting the Balancer for it to apply.

For more information about Lua scripting please visit the Lua website.

Updated on October 3, 2018

Was this article helpful?

Related Articles