Skip to content

Commit

Permalink
Update module config file (#36)
Browse files Browse the repository at this point in the history
Nginx dynamic module build system can compile multiple modules in a single .so

* ngx_module_name https://www.nginx.com/resources/wiki/extending/new_config/#key-ngx_module_name
This will let users enable/disable HTTP or STREAM or both module[s] by using `--without-http` or `--with-stream`
  • Loading branch information
Lax authored May 25, 2019
1 parent ea2ef10 commit 712cf7f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 38 deletions.
46 changes: 44 additions & 2 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,47 @@ TRAFFIC_ACCOUNTING_SRCS=" \
$ngx_addon_dir/src/ngx_traffic_accounting_statuses.c \
"

. $ngx_addon_dir/ngx_http_accounting_module
#. $ngx_addon_dir/ngx_stream_accounting_module
HTTP_ACCOUNTING_DEPS=" \
$ngx_addon_dir/src/http/ngx_http_accounting_module.h \
"
HTTP_ACCOUNTING_SRCS=" \
$ngx_addon_dir/src/http/ngx_http_accounting_module.c \
$ngx_addon_dir/src/http/ngx_http_accounting_statuses.c \
"

STREAM_ACCOUNTING_DEPS=" \
$ngx_addon_dir/src/stream/ngx_stream_accounting_module.h \
"
STREAM_ACCOUNTING_SRCS=" \
$ngx_addon_dir/src/stream/ngx_stream_accounting_module.c \
$ngx_addon_dir/src/stream/ngx_stream_accounting_statuses.c \
"

ngx_module_type=
ngx_module_name=
ngx_module_incs=$ngx_addon_dir
ngx_module_deps=$TRAFFIC_ACCOUNTING_DEPS
ngx_module_srcs=$TRAFFIC_ACCOUNTING_SRCS
ngx_module_libs=

if [ $HTTP != NO ]
then
ngx_module_type=HTTP
ngx_module_name="ngx_http_accounting_module"
ngx_module_deps="$ngx_module_deps $HTTP_ACCOUNTING_DEPS"
ngx_module_srcs="$ngx_module_srcs $HTTP_ACCOUNTING_SRCS"
fi

if [ $STREAM != NO ]
then
ngx_module_type=STREAM
if test -n "$ngx_module_name"; then
ngx_module_name="ngx_http_accounting_module ngx_stream_accounting_module"
else
ngx_module_name="ngx_stream_accounting_module"
fi
ngx_module_deps="$ngx_module_deps $STREAM_ACCOUNTING_DEPS"
ngx_module_srcs="$ngx_module_srcs $STREAM_ACCOUNTING_SRCS"
fi

. auto/module
17 changes: 0 additions & 17 deletions ngx_http_accounting_module

This file was deleted.

17 changes: 0 additions & 17 deletions ngx_stream_accounting_module

This file was deleted.

2 changes: 1 addition & 1 deletion samples/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN yum install gcc make pcre-devel zlib-devel openssl-devel -y \
&& yum clean all

ENV PREFIX /opt/nginx
ENV NGX_VER 1.14.0
ENV NGX_VER 1.16.0

ENV WORKDIR /src
ENV NGX_SRC_DIR ${WORKDIR}/nginx-${NGX_VER}
Expand Down
2 changes: 1 addition & 1 deletion samples/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load_module modules/ngx_http_accounting_module.so;
load_module modules/ngx_stream_accounting_module.so;
#load_module modules/ngx_stream_accounting_module.so;
load_module modules/ngx_http_echo_module.so;

worker_processes auto;
Expand Down

0 comments on commit 712cf7f

Please sign in to comment.