forked from openresty/lua-nginx-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathngx_http_lua_config.c
More file actions
70 lines (48 loc) · 1.31 KB
/
Copy pathngx_http_lua_config.c
File metadata and controls
70 lines (48 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (C) Yichun Zhang (agentzh)
*/
#ifndef DDEBUG
#define DDEBUG 0
#endif
#include "ddebug.h"
#include "ngx_http_lua_config.h"
#include "api/ngx_http_lua_api.h"
static int ngx_http_lua_config_prefix(lua_State *L);
static int ngx_http_lua_config_configure(lua_State *L);
void
ngx_http_lua_inject_config_api(lua_State *L)
{
/* ngx.config */
lua_createtable(L, 0, 6 /* nrec */); /* .config */
#if (NGX_DEBUG)
lua_pushboolean(L, 1);
#else
lua_pushboolean(L, 0);
#endif
lua_setfield(L, -2, "debug");
lua_pushcfunction(L, ngx_http_lua_config_prefix);
lua_setfield(L, -2, "prefix");
lua_pushinteger(L, nginx_version);
lua_setfield(L, -2, "nginx_version");
lua_pushinteger(L, ngx_http_lua_version);
lua_setfield(L, -2, "ngx_lua_version");
lua_pushcfunction(L, ngx_http_lua_config_configure);
lua_setfield(L, -2, "nginx_configure");
lua_pushliteral(L, "http");
lua_setfield(L, -2, "subsystem");
lua_setfield(L, -2, "config");
}
static int
ngx_http_lua_config_prefix(lua_State *L)
{
lua_pushlstring(L, (char *) ngx_cycle->prefix.data,
ngx_cycle->prefix.len);
return 1;
}
static int
ngx_http_lua_config_configure(lua_State *L)
{
lua_pushliteral(L, NGX_CONFIGURE);
return 1;
}
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */