leslie-tsang commented on a change in pull request #5052:
URL: https://github.com/apache/apisix/pull/5052#discussion_r707488747



##########
File path: apisix/plugins/ck-auth.lua
##########
@@ -0,0 +1,54 @@
+local core = require("apisix.core")
+
+local plugin_name = "ck-auth"
+local status_codes = {
+    200, 401
+}
+local schema = {
+    type = "object",
+    properties = {
+        king = {
+            type = "string",
+            enum = { "ck" }
+        }
+    },
+    required = { "king" }
+}
+
+local _M = {
+    version = 0.1,
+    priority = 90,
+    name = plugin_name,
+    schema = schema,
+}
+
+function _M.check_schema(conf)
+    return core.schema.check(schema, conf)
+end
+
+function _M.access(conf, ctx)
+
+    core.log.info("access")
+
+end
+
+-- 返回参数的固定格式
+local function responseBody(status_code, message)
+    return status_code, {
+        status_code = status_code,
+        message = message,
+        data = nil
+    }
+end
+
+function _M.rewrite(conf, ctx)
+    core.log.info("rewrite")
+    local auth_token = core.request.header(ctx, "ck")
+    if not auth_token then
+        return responseBody(status_codes[2], "没有在header里面传入程锟的插件认证关键参数")
+    end
+    return responseBody(status_codes[1], auth_token)
+end
+
+
+return _M

Review comment:
       No new line at the end of file

##########
File path: Dockerfile
##########
@@ -0,0 +1,53 @@
+ARG ENABLE_PROXY=true
+
+FROM openresty/openresty:1.19.3.1-alpine-fat AS production-stage
+
+ARG ENABLE_PROXY
+ARG APISIX_PATH=.
+COPY $APISIX_PATH ./apisix
+RUN set -x \
+    && echo  https://mirrors.aliyun.com/alpine/v3.13/main > 
/etc/apk/repositories \
+    && echo  https://mirrors.aliyun.com/alpine/v3.13/community >> 
/etc/apk/repositories \
+    # && apk add --no-cache --virtual .builddeps 
+    && apk add --no-cache --virtual .builddeps \
+    automake \
+    autoconf \
+    libtool \
+    pkgconfig \
+    cmake \
+    git \
+    pcre \
+    pcre-dev \
+    && cd apisix \
+    && make deps \
+    && cp -v bin/apisix /usr/bin/ \
+    && mv ../apisix /usr/local/apisix \
+    && apk del .builddeps build-base make unzip
+
+FROM alpine:3.13 AS last-stage
+
+ARG ENABLE_PROXY
+# add runtime for Apache APISIX
+RUN set -x \
+    && echo  https://mirrors.aliyun.com/alpine/v3.13/main > 
/etc/apk/repositories \
+    && echo  https://mirrors.aliyun.com/alpine/v3.13/community >> 
/etc/apk/repositories \
+    && apk add --no-cache bash libstdc++ curl tzdata
+
+WORKDIR /usr/local/apisix
+
+COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/
+COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/
+COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix
+
+# forward request and error logs to docker log collector
+RUN mkdir -p logs && touch logs/access.log && touch logs/error.log \
+    && ln -sf /dev/stdout /usr/local/apisix/logs/access.log \
+    && ln -sf /dev/stderr /usr/local/apisix/logs/error.log
+
+ENV 
PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
+
+EXPOSE 9080 9443
+
+CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && 
/usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]
+
+STOPSIGNAL SIGQUIT

Review comment:
       No new line at the end of file




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to