3 if LUA_WEB_APP_FRAMEWORK then |
3 if LUA_WEB_APP_FRAMEWORK then |
4 package.path = ("%s/?.lua;%s"):format(LUA_WEB_APP_FRAMEWORK, package.path); |
4 package.path = ("%s/?.lua;%s"):format(LUA_WEB_APP_FRAMEWORK, package.path); |
5 package.cpath = ("%s/?.so;%s"):format(LUA_WEB_APP_FRAMEWORK, package.cpath); |
5 package.cpath = ("%s/?.so;%s"):format(LUA_WEB_APP_FRAMEWORK, package.cpath); |
6 end |
6 end |
7 |
7 |
|
8 package.preload["net.adns"] = function () |
|
9 return (require "net.unbound"); |
|
10 end; |
8 local ssl = require "ssl"; |
11 local ssl = require "ssl"; |
9 local server = require "net.server_epoll"; |
12 local server = require "net.server_epoll"; |
10 local envload = require"util.envload"; |
13 local envload = require"util.envload"; |
11 local logger = require "util.logger"; |
14 local logger = require "util.logger"; |
12 |
15 |
56 if config.loglevel == level then break; end |
59 if config.loglevel == level then break; end |
57 end |
60 end |
58 end |
61 end |
59 log("debug", "Logging ready"); |
62 log("debug", "Logging ready"); |
60 |
63 |
|
64 -- Configure HTTP client |
|
65 require "net.http".default.options.sslctx = server.tls_builder(".") |
|
66 :apply({mode="client", protocol="sslv23", options="no_sslv2",capath="/etc/ssl/certs"}) |
|
67 :build(); |
|
68 |
61 require "http".init(config, events); |
69 require "http".init(config, events); |
62 |
70 |
63 -- Load optional extensions specified in the config |
71 -- Load optional extensions specified in the config |
64 for _, ext in ipairs(config.extensions or {}) do |
72 for _, ext in ipairs(config.extensions or {}) do |
65 require("extensions."..ext).init(config, events); |
73 require("extensions."..ext).init(config, events); |