Browse Source

Lapis: Use pgmoon postgresql backend

Tor Hveem 11 years ago
parent
commit
a988d43a3a

+ 7 - 4
frameworks/Lua/lapis/config.lua

@@ -3,12 +3,15 @@ do
   local _obj_0 = require("lapis.config")
   config = _obj_0.config
 end
-config("development", function()
-  return postgresql_url("postgres://benchmarkdbuser:[email protected]/hello_world")
-end)
+config("development", function() end)
 return config("production", function()
   port(80)
   num_workers(4)
   lua_code_cache("on")
-  return postgresql_url("postgres://benchmarkdbuser:[email protected]/hello_world")
+  return postgres({
+    backend = "pgmoon",
+    database = "hello_world",
+    user = "postgres",
+    host = "DBHOSTNAME"
+  })
 end)

+ 6 - 2
frameworks/Lua/lapis/config.moon

@@ -1,10 +1,14 @@
 import config from require "lapis.config"
 
 config "development", ->
-  postgresql_url "postgres://benchmarkdbuser:[email protected]/hello_world"
 
 config "production", ->
   port 80
   num_workers 4
   lua_code_cache "on"
-  postgresql_url "postgres://benchmarkdbuser:[email protected]/hello_world"
+  postgres {
+    backend: "pgmoon"
+    database: "hello_world"
+    user: "postgres"
+    host: "DBHOSTNAME"
+  }

+ 1 - 0
frameworks/Lua/lapis/setup.py

@@ -4,6 +4,7 @@ import setup_util
 import os
 
 def start(args, logfile, errfile):
+  setup_util.replace_text("lapis/config.lua", "DBHOSTNAME", args.database_host)
   setup_util.replace_text("lapis/nginx.conf", "DBHOSTNAME", args.database_host)
   #subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
   subprocess.Popen('lapis server production', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)