Skip to content

Commit a18afea

Browse files
authored
change: added doc of how to load plugin. (#1)
1 parent f015b16 commit a18afea

8 files changed

Lines changed: 29 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ luac.out
4343
logs
4444
t/servroot
4545
go
46+
\.*

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
# apimeta
1+
# Summary
2+
3+
# Design Doc
4+
5+
### How to load the plugin?
6+
7+
![](doc/flow-load-plugin.png)
8+
9+
### Plugin
10+
11+
![](doc/flow-plugin-internal.png)
12+
13+
14+
# Development
15+
16+
### Source Install
17+
18+
> Dependent library
19+
20+
* Setups the [resty-r3#install](https://github.com/iresty/lua-resty-r3#install) library.
21+

conf/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ etcd:
22
host: "http://127.0.0.1:2379"
33
prefix: "/v2/keys"
44
timeout: 60
5+
6+
plugins:
7+
- example_plugin

doc/apimeta-plugin-design.graffle

10.5 KB
Binary file not shown.

doc/flow-load-plugin.png

224 KB
Loading

doc/flow-plugin-internal.png

519 KB
Loading

lua/apimeta/comm/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local function read_file(path)
1515
return nil
1616
end
1717

18-
local content = file:read("*a") -- *a or *all reads the whole file
18+
local content = file:read("*a") -- `*a` reads the whole file
1919
file:close()
2020
return content
2121
end

t/yaml-config.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ __DATA__
1515
content_by_lua_block {
1616
local encode_json = require "cjson.safe" .encode
1717
local config = require("apimeta.comm.config").read()
18+
1819
ngx.say("etcd host: ", config.etcd.host)
1920
ngx.say("etcd prefix: ", config.etcd.prefix)
21+
ngx.say("plugins: ", encode_json(config.plugins))
2022
}
2123
}
2224
--- request
2325
GET /t
2426
--- response_body
2527
etcd host: http://127.0.0.1:2379
2628
etcd prefix: /v2/keys
29+
plugins: ["example_plugin"]

0 commit comments

Comments
 (0)