Hi, list!

I need to pass two extra config variables to my wsapi handlers. In
nginx I'm doing this in config:

    fastcgi_param  MY_CONFIG_HOST "127.0.0.1";
    fastcgi_param  MY_CONFIG_PORT "42";

But to do black-box HTTP request testing, I'm using Xavante to spawn
wsapi in my test code (xavante is spawned right from the testing
framework). What is the way to pass these variables using
wsapi.xavante?

Here is how I do this now (my setup does not need a docroot, loader
returns my wsapi run() function, this code is run in a fork by testing
framework):

      -- TODO: UBERHACK!
      local FAKE_DOCROOT = tserialize(
          {
            MY_CONFIG_HOST = config_host;
            MY_CONFIG_PORT = config_port;
          }
        )

      local rules =
      {
        {
          match = { ".*" };
          with = wsapi.xavante.makeHandler(loader(), "/", FAKE_DOCROOT, "")
        }
      }

      xavante.HTTP
      {
        server = { host = host; port = port };

        defaultHost =
        {
          rules = rules;
        };
      }

      xavante.start()

I really hate this workaround. Is there a better way?

Alexander.

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to