upyun / slardar

Updating your upstream list and run lua scripts without reloading Nginx.
493 stars 111 forks source link

some question #18

Open liuyangc3 opened 7 years ago

liuyangc3 commented 7 years ago

I notice that in init phase, slardar get skeys from consul by using ip:port/v1/kv/config/slardar/http_upstreams?keys and server from ip:port/v1/kv/upstreams/skey?raws by default.

my questions is: 1 what data format exactly sore in v1/kv/config/slardar/http_upstreams

2 what is the value of key in v1/kv/upstreams/key, ant what is the raw value of v1/kv/upstreams/key?raw,myabe it is in my guess:

'{"servers": [{"host": "127.0.0.1","port": 8001,"weight": 1,"max_fails": 6,"fail_timeout": 30}],
  "keepalive" : 1, "try": 1, "enable": true }'

I cant find any explanation in this project doc,thx

yejingx commented 7 years ago
  1. The data is in json format, you can refer to consul-configuration. here is an example,
{"enable": true, "servers": [{"host": "127.0.0.1","port": 8001,"weight": 1,"max_fails": 6,"fail_timeout": 30}]}
  1. The value of /v1/kv/upstreams/key returned from consul is base64 encoded, while /v1/kv/upstreams/key?raw is not.

For more information, you can refer to the api docs of consul.