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"
|
config = require "lapis.config"
|
||||||
|
|
||||||
|
ffi = actualrequire("ffi")
|
||||||
|
ffi.cdef [[
|
||||||
|
char *getenv(const char *name)
|
||||||
|
]]
|
||||||
|
|
||||||
|
getenv = (name) ->
|
||||||
|
ffi.string ffi.C.getenv name
|
||||||
|
|
||||||
config "development", ->
|
config "development", ->
|
||||||
port 8080
|
port 8080
|
||||||
|
|
||||||
|
@ -15,8 +23,8 @@ config "docker", ->
|
||||||
|
|
||||||
postgres ->
|
postgres ->
|
||||||
backend "pgmoon"
|
backend "pgmoon"
|
||||||
port os.getenv "POSTGRESQL_PORT_5432_TCP_PORT"
|
port getenv "POSTGRESQL_PORT_5432_TCP_PORT"
|
||||||
host os.getenv "POSTGRESQL_PORT_5432_TCP_ADDR"
|
host getenv "POSTGRESQL_PORT_5432_TCP_ADDR"
|
||||||
user os.getenv "DB_USER"
|
user getenv "DB_USER"
|
||||||
password os.getenv "DB_PASS"
|
password getenv "DB_PASS"
|
||||||
database os.getenv "DB_NAME"
|
database getenv "DB_NAME"
|
||||||
|
|
|
@ -16,6 +16,7 @@ http {
|
||||||
location / {
|
location / {
|
||||||
default_type text/html;
|
default_type text/html;
|
||||||
content_by_lua '
|
content_by_lua '
|
||||||
|
actualrequire = require
|
||||||
require = require"require".require
|
require = require"require".require
|
||||||
require("moonscript")
|
require("moonscript")
|
||||||
require("lapis").serve("app")
|
require("lapis").serve("app")
|
||||||
|
|
Loading…
Reference in New Issue