Skip to content

change: added doc of how to load plugin. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ luac.out
logs
t/servroot
go
\.*
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# apimeta
# Summary

# Design Doc

### How to load the plugin?

![](doc/flow-load-plugin.png)

### Plugin

![](doc/flow-plugin-internal.png)


# Development

### Source Install

> Dependent library

* Setups the [resty-r3#install](https://github.com/iresty/lua-resty-r3#install) library.

3 changes: 3 additions & 0 deletions conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ etcd:
host: "http://127.0.0.1:2379"
prefix: "/v2/keys"
timeout: 60

plugins:
- example_plugin
Binary file added doc/apimeta-plugin-design.graffle
Binary file not shown.
Binary file added doc/flow-load-plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/flow-plugin-internal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lua/apimeta/comm/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local function read_file(path)
return nil
end

local content = file:read("*a") -- *a or *all reads the whole file
local content = file:read("*a") -- `*a` reads the whole file
file:close()
return content
end
Expand Down
3 changes: 3 additions & 0 deletions t/yaml-config.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ __DATA__
content_by_lua_block {
local encode_json = require "cjson.safe" .encode
local config = require("apimeta.comm.config").read()

ngx.say("etcd host: ", config.etcd.host)
ngx.say("etcd prefix: ", config.etcd.prefix)
ngx.say("plugins: ", encode_json(config.plugins))
}
}
--- request
GET /t
--- response_body
etcd host: http://127.0.0.1:2379
etcd prefix: /v2/keys
plugins: ["example_plugin"]