File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,20 +27,24 @@ docker run -d --name config-api -p 5000:5000 ztj1993/config-api
2727
2828## 使用示例
2929```
30+ $ #获取配置原始数据
3031$ data=$(cat /etc/docker/daemon.json) && echo ${data}
3132
3233 {
3334 "registry-mirrors": ["http://ef017c13.m.daocloud.io"]
3435 }
3536
37+ $ #初始化配置游标
3638$ cursor_id=$(curl -sf http://127.0.0.1:5000/init) && echo ${cursor_id}
3739
3840 158853936809905161020585456234816085535
3941
42+ $ #将配置上传到游标
4043$ curl http://127.0.0.1:5000/${cursor_id}/load/json -d "${data}"
4144
4245 ok
4346
47+ $ #操作配置
4448$ curl http://127.0.0.1:5000/${cursor_id}/set/bool?key=tlsverify -d "true"
4549$ curl http://127.0.0.1:5000/${cursor_id}/set/str?key=tlscacert -d "/etc/certs/ca.pem"
4650$ curl http://127.0.0.1:5000/${cursor_id}/set/str?key=tlscert -d "/etc/certs/server-cert.pem"
@@ -50,6 +54,7 @@ $ curl http://127.0.0.1:5000/${cursor_id}/append/str?key=hosts -d "unix:///var/r
5054
5155 ok
5256
57+ $ #输出配置
5358$ curl http://127.0.0.1:5000/${cursor_id}/output/json
5459
5560 {
You can’t perform that action at this time.
0 commit comments