Use ffi for config

This commit is contained in:
Sam Dodrill 2015-01-09 19:08:54 -08:00
parent 7d2509e469
commit 830fd195dc
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,13 @@
config = require "lapis.config"
ffi = actualrequire("ffi")
ffi.cdef [[
char *getenv(const char *name)
]]
getenv = (name) ->
ffi.string ffi.C.getenv name
config "development", ->
port 8080
@ -15,8 +23,8 @@ config "docker", ->
postgres ->
backend "pgmoon"
port os.getenv "POSTGRESQL_PORT_5432_TCP_PORT"
host os.getenv "POSTGRESQL_PORT_5432_TCP_ADDR"
user os.getenv "DB_USER"
password os.getenv "DB_PASS"
database os.getenv "DB_NAME"
port getenv "POSTGRESQL_PORT_5432_TCP_PORT"
host getenv "POSTGRESQL_PORT_5432_TCP_ADDR"
user getenv "DB_USER"
password getenv "DB_PASS"
database getenv "DB_NAME"

View File

@ -16,6 +16,7 @@ http {
location / {
default_type text/html;
content_by_lua '
actualrequire = require
require = require"require".require
require("moonscript")
require("lapis").serve("app")