1. Home
  2. Balancer
  3. Add Lua Scripts to your Snapt One Load Balancer

Add Lua Scripts to your Snapt One Load Balancer

Add new Lua script

New to Snapt One Load 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 load balancer configuration.

All Lua scripts are available under Existing scripts. 

You can remove any of them with the Delete Script button.

Load Lua scripts into a 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 to load it. The contents of the script will also be shown 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 be selected 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 Load Balancer for it to apply.

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

Updated on December 10, 2019


Was this article helpful?

Related Articles