Skip to content

Commit c5f0d76

Browse files
committed
updating readme
1 parent 2242f2c commit c5f0d76

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,89 @@
11
# Flagship Module for Nginx
2+
3+
Adds the ability to feature management in web server level.
4+
5+
## Build
6+
7+
To link statically against nginx, cd to nginx source directory and execute:
8+
9+
./configure --with compat --add-module=/path/to/flagship-nginx-module --with-pcre
10+
11+
To compile as a dynamic module (nginx 1.9.11+), use:
12+
13+
./configure --with compat --add-dynamic-module=/path/to/flagship-nginx-module --with-pcre
14+
15+
In this case, the `load_module` directive should be used in nginx.conf to load the module.
16+
17+
## Configuration
18+
19+
### fs_init
20+
* **syntax**: `fs_init 'env_id' 'api_key' 'polling_interval' 'log_level';`
21+
* **default**: `none`
22+
* **context**: `server`
23+
24+
Initialize the SDK with 4 arguments : Environment id, Api Key, Polling Interval and Log level.
25+
Once the initialization is done the 1st time, the second you execute the script it will bypass the initialization.
26+
27+
### set_visitor_id
28+
* **syntax**: `set_visitor_id 'visitor_id';`
29+
* **default**: `none`
30+
* **context**: `location`
31+
32+
Set the visitor id
33+
34+
### set_visitor_context
35+
* **syntax**: `set_visitor_context 'visitor_context';`
36+
* **default**: `none`
37+
* **context**: `location`
38+
39+
Set the visitor context
40+
41+
### get_all_flags
42+
* **syntax**: `get_all_flags;`
43+
* **default**: `none`
44+
* **context**: `location`
45+
46+
Execute the function getAllFlags that return the flags based on visitor id and context but does not return it in nginx it rather store it in variable named fs_sdk_cache_var that you can use as a key/value in nginx cache table for feature management.
47+
Note that you have to initialize the sdk and setting visitor id and context before running get_all_flags directive.
48+
49+
50+
## Sample configuration
51+
```
52+
http {
53+
54+
server {
55+
56+
fs_init 'env_id' 'api_key' 'polling_interval' 'log_level';
57+
58+
location /test {
59+
set_visitor_id 'visitor_id_test';
60+
set_visitor_context 'visitor_context_test';
61+
get_all_flags;
62+
63+
echo $fs_sdk_cache_var;
64+
}
65+
66+
location /experiment {
67+
set_visitor_id 'visitor_id_experiment';
68+
set_visitor_context 'visitor_context_experiment';
69+
get_all_flags;
70+
71+
echo $fs_sdk_cache_var;
72+
}
73+
}
74+
```
75+
this module uses Go wrapper for C, which is based on the Go SDK that implement bucketing mode.
76+
77+
so the return on /test if we set visitor_id_test & visitor_context_test match isVip: false, will be:
78+
```
79+
isVip:false;
80+
```
81+
and the return on /experiment if we set visitor_id_experiment & visitor_context_experiment match isVip: true, will be:
82+
```
83+
isVip:true;
84+
```
85+
86+
87+
88+
## Copyright & License
89+

0 commit comments

Comments
 (0)