nginxopenrestymoonscriptlapis

Lapis not using values from config.moon


I'm following the guides on leafo.net/lapis to create a configuration file. My config.moon is in the top level folder of the app and looks like this

config = require "lapis.config"

config "development", ->
  port 5001

When I run lapis build or lapis server, I can see that the datestamp on my nginx.conf.compiled has changed, but it appears to have ignored my configuration, as it's still listening on port 8080

  server {
    listen 8080;
    lua_code_cache off;

lapis server will therefore attempt to connect at that port and fail. What have I missed?

App structure:

.. (up a dir)
/home/sam/lapis-example/
▸ client_body_temp/
▸ fastcgi_temp/
▸ logs/
▸ proxy_temp/
▸ scgi_temp/
▸ uwsgi_temp/
  app.moon
  config.moon
  mime.types
  models.moon
  nginx.conf
  nginx.conf.compiled

Solution

  • You'll need to compile your .moon files to .lua in order for the Lapis command line tool to read them. The command line tools do not know how to load .moon files on their own.

    You can do this using the moonc command, run this in the top level directory:

    moonc .
    

    You can have it automatically compile using the watch command:

    moonc -w .