|
2 | 2 |
|
3 | 3 | ## Implementation |
4 | 4 |
|
5 | | -NOTE: The following implementation steps have been developed and tested using this [Docker image](https://github.com/fabiocicerchia/nginx-lua). |
| 5 | +NOTES: |
| 6 | + - The following implementation steps have been developed and tested using this [Docker image](https://github.com/fabiocicerchia/nginx-lua). |
| 7 | + - The following example uses `./usr/queueit` as the base path for storing all the Queue-it related files. Review and modify it to your needs. |
6 | 8 |
|
7 | | -1) Copy the handler file and the following two folders from this repository to your NGINX filesystem. In the following example we will use `./usr/queueit` as the base path. |
8 | | - * [KnownUserNginxHandler.lua](https://github.com/queueit/KnownUser.V3.Lua/blob/master/Handlers/KnownUserNginxHandler.lua) -> `./usr/queueit/KnownUserNginxHandler.lua` |
9 | | - * [SDK](https://github.com/queueit/KnownUser.V3.Lua/tree/master/SDK) -> `./usr/queueit/SDK` |
10 | | - * [Helpers](https://github.com/queueit/KnownUser.V3.Lua/tree/master/Helpers) -> `./usr/queueit/Helpers` |
11 | | - |
12 | 9 |
|
13 | | -2) Update or add the `lua_package_path` configuration option in your `nginx.conf` to include the new paths. Make sure to keep `;;` in the end which means default path: |
| 10 | +### 1. Copy the necessary files to your NGINX filesystem |
14 | 11 |
|
15 | | - ``` |
16 | | - http { |
17 | | - lua_package_path "./usr/queueit/?.lua;./usr/queueit/SDK/?.lua;./usr/queueit/Helpers/?/?.lua;;"; |
18 | | - } |
19 | | - ``` |
| 12 | +Copy the following two folders from this repository to your NGINX filesystem: |
| 13 | +- [SDK](https://github.com/queueit/KnownUser.V3.Lua/tree/master/SDK) -> `./usr/queueit/SDK` |
| 14 | +- [Helpers](https://github.com/queueit/KnownUser.V3.Lua/tree/master/Helpers) -> `./usr/queueit/Helpers` |
| 15 | + |
| 16 | +Copy the main handler script: |
| 17 | + |
| 18 | +- [Handlers/KnownUserNginxHandler.lua](https://github.com/queueit/KnownUser.V3.Lua/blob/master/Handlers/KnownUserNginxHandler.lua) -> `./usr/queueit/KnownUserNginxHandler.lua` |
| 19 | + |
| 20 | + |
| 21 | +### 2. Update the package paths |
| 22 | + |
| 23 | +Update or add the `lua_package_path` configuration option in the `http` section of your main configuration file (typically `nginx.conf`) to include the new paths you created in Step 1. Make sure to keep `;;` in the end which means default path: |
| 24 | + |
| 25 | +``` |
| 26 | +http { |
| 27 | + lua_package_path "./usr/queueit/?.lua;./usr/queueit/SDK/?.lua;./usr/queueit/Helpers/?/?.lua;;"; |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | + |
| 32 | +### 3. Add the Queue-it handler to a specific location |
20 | 33 |
|
21 | | -3) Then update the configuration file relative to the location you want to be protected by Queue-it (`conf.d/default.conf` or similar): |
| 34 | +Update the configuration file relative to the location you want to be protected by Queue-it (`conf.d/default.conf` or similar): |
22 | 35 |
|
23 | 36 | ``` |
24 | 37 | server { |
@@ -47,15 +60,15 @@ NOTE: The following implementation steps have been developed and tested using th |
47 | 60 | } |
48 | 61 | ``` |
49 | 62 |
|
50 | | - * Replace the following two placeholders in the above code `{CUSTOMER_ID}` and `{SECRET_KEY}` with respective values located in GO Queue-it platform. |
51 | | - * NOTE: In this example `rewrite_by_lua_block` directive was added to default location `/` but you must decide what makes sense in your case. |
| 63 | +- Replace the following two placeholders in the above code `{CUSTOMER_ID}` and `{SECRET_KEY}` with respective values located in GO Queue-it platform. |
| 64 | +- NOTE: In this example `rewrite_by_lua_block` directive was added to default location `/` but you must decide what makes sense in your case. |
52 | 65 |
|
53 | 66 |
|
54 | | -4) Provide the `integrationconfig.json`... |
| 67 | +### 4) Provide the `integrationconfig.json`... |
55 | 68 |
|
56 | 69 |
|
57 | 70 |
|
58 | | -### Request body trigger (advanced) |
| 71 | +## Request body trigger (advanced) |
59 | 72 | Nginx handler (incl. Lua SDK) supports triggering on request body content. Example could be a POST call with specific item ID where you want end-users to queue up for. |
60 | 73 | You will need to contact queue-it support if this functionality is needed, so it can be enabled on your GO Queue-it platform account. |
61 | 74 | When enabled you also need to add extra settings to `location` in `conf.d/default.conf`: |
|
0 commit comments