changeset 1184:2eba58842bbb

remove serve_for_nginx
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 21 Feb 2018 16:51:56 -0700
parents 0f2890e2ba16
children 94cf2576a922
files src/luan/modules/http/Server.luan src/luan/modules/http/serve_for_nginx.luan
diffstat 2 files changed, 4 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
diff -r 0f2890e2ba16 -r 2eba58842bbb src/luan/modules/http/Server.luan
--- a/src/luan/modules/http/Server.luan	Wed Feb 21 16:29:43 2018 -0700
+++ b/src/luan/modules/http/Server.luan	Wed Feb 21 16:51:56 2018 -0700
@@ -32,7 +32,7 @@
 
 Server.port = 8080
 
-local function init_dir(dir)
+function Server.init_dir(dir)
 	local dir_uri, dir_path
 	if matches(dir,":") then
 		dir_uri = dir
@@ -49,7 +49,7 @@
 	return dir_path
 end
 
-local function start()
+function Server.start()
 	try {
 		function()
 			LuanHandler.start(Server.server)
@@ -70,7 +70,7 @@
 end
 
 function Server.serve(dir)
-	local dir_path = init_dir(dir)
+	local dir_path = Server.init_dir(dir)
 	local file_handler = FileHandler.new(dir_path)
 	local dir_handler = DirHandler.new(file_handler)
 	local luan_handler = LuanHandler.new()
@@ -82,22 +82,8 @@
 	handler = SafeHandler.new(handler)
 	handler = LogHandler.new(handler)
 	Server.server = JavaServer.new(Server.port,handler)
-	start()
+	Server.start()
 	Server.start_rpc()
 end
 
-function Server.serve_for_nginx(dir)
-	init_dir(dir)
-	local luan_handler = LuanHandler.new()
-	local not_found_hander = NotFound.new(luan_handler)
-	local handler = luan_handler
-	handler = IndexHandler.new(handler)
-	handler = ListHandler.new( handler, not_found_hander )
-	handler = ContentTypeHandler.new(handler)
-	handler = SafeHandler.new(handler)
-	handler = LogHandler.new(handler)
-	Server.server = JavaServer.ForAddress.new("127.0.0.1",Server.port,handler)
-	start()
-end
-
 return Server
diff -r 0f2890e2ba16 -r 2eba58842bbb src/luan/modules/http/serve_for_nginx.luan
--- a/src/luan/modules/http/serve_for_nginx.luan	Wed Feb 21 16:29:43 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-local Io = require "luan:Io.luan"
-local Server = require "luan:http/Server.luan"
-
-if #{...} ~= 1 then
-	Io.stderr.write "usage: luan luan:http/serve_for_nginx dir\n"
-	return
-end
-
-Server.port = 8081
-Server.serve_for_nginx(...)