Skip to content

Commit

Permalink
fix(acme) remove BasePlugin dependency (#3)
Browse files Browse the repository at this point in the history
Inheriting from BasePlugin is no longer needed and can cause
performance drop.

See #2
  • Loading branch information
fffonion authored Dec 12, 2019
1 parent 656950c commit d69c23c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions kong/plugins/acme/handler.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local BasePlugin = require("kong.plugins.base_plugin")
local kong_certificate = require("kong.runloop.certificate")

local client = require("kong.plugins.acme.client")
Expand All @@ -13,26 +12,19 @@ local acme_challenge_path = [[^/\.well-known/acme-challenge/(.+)]]
-- cache for dummy cert kong generated (it's a table)
local default_cert_key

local LetsencryptHandler = BasePlugin:extend()
local LetsencryptHandler = {}

LetsencryptHandler.PRIORITY = 1000
LetsencryptHandler.VERSION = "0.0.1"

function LetsencryptHandler:new()
LetsencryptHandler.super.new(self, "acme")
end
LetsencryptHandler.VERSION = "0.1.0"

function LetsencryptHandler:init_worker()
LetsencryptHandler.super.init_worker(self, "acme")

kong.log.info("acme renew timer started")
ngx.timer.every(86400, client.renew_certificate)
end


-- access phase is to terminate the http-01 challenge request if necessary
function LetsencryptHandler:access(conf)
LetsencryptHandler.super.access(self)

local protocol = kong.client.get_protocol()

Expand Down

0 comments on commit d69c23c

Please sign in to comment.