Use ffi for config
This commit is contained in:
parent
7d2509e469
commit
830fd195dc
18
config.moon
18
config.moon
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue