mirror of
https://github.com/lxsang/ant-http
synced 2024-12-25 16:28:21 +01:00
add config files
This commit is contained in:
parent
296fae73c3
commit
01722ae39c
1
.gitignore
vendored
1
.gitignore
vendored
@ -67,7 +67,6 @@ libtool
|
|||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
config.sub
|
config.sub
|
||||||
config.ini.tpl
|
|
||||||
configure
|
configure
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
|
12
Makefile.am
12
Makefile.am
@ -10,7 +10,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
AM_CPPFLAGS += -W -Wall -g -std=c99
|
AM_CPPFLAGS += -W -Wall -g -std=c99 -DCONFIG_FILE=\"$(sysconfdir)/antd-config.ini\"
|
||||||
|
|
||||||
lib_LTLIBRARIES = libantd.la
|
lib_LTLIBRARIES = libantd.la
|
||||||
libantd_la_SOURCES = lib/ini.c \
|
libantd_la_SOURCES = lib/ini.c \
|
||||||
@ -34,7 +34,7 @@ pkginclude_HEADERS = lib/ini.h \
|
|||||||
lib/scheduler.h \
|
lib/scheduler.h \
|
||||||
lib/plugin.h
|
lib/plugin.h
|
||||||
|
|
||||||
EXTRA_DIST = plugin_manager.h http_server.h README.md LICENSE
|
EXTRA_DIST = plugin_manager.h http_server.h README.md LICENSE antd-config.ini
|
||||||
# check for db
|
# check for db
|
||||||
if DB
|
if DB
|
||||||
libantd_la_SOURCES += lib/dbhelper.c
|
libantd_la_SOURCES += lib/dbhelper.c
|
||||||
@ -46,3 +46,11 @@ bin_PROGRAMS = antd
|
|||||||
# lib source files
|
# lib source files
|
||||||
antd_SOURCES = plugin_manager.c http_server.c httpd.c
|
antd_SOURCES = plugin_manager.c http_server.c httpd.c
|
||||||
antd_LDADD = libantd.la
|
antd_LDADD = libantd.la
|
||||||
|
|
||||||
|
sysconf_DATA = antd-config.ini
|
||||||
|
|
||||||
|
#install-data-local: $(srcdir)/conf/config.file $(srcdir)/conf/sub1/config.file
|
||||||
|
# mkdir $(sysconfdir)/conf
|
||||||
|
# cp $(srcdir)/conf/config.file $(sysconfdir)/conf
|
||||||
|
# mkdir $(sysconfdir)/conf/sub1
|
||||||
|
# cp $(srcdir)/conf/sub1/config.file $(sysconfdir)/conf/sub1
|
52
antd-config.ini
Normal file
52
antd-config.ini
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
[SERVER]
|
||||||
|
; server port
|
||||||
|
; use 443 if one want to use
|
||||||
|
; SSL
|
||||||
|
port=8080
|
||||||
|
; plugin directory
|
||||||
|
plugins=/opt/www/plugins/
|
||||||
|
; plugin extension
|
||||||
|
plugins_ext=.dylib
|
||||||
|
; SQLITE database path
|
||||||
|
database=/opt/www/database/
|
||||||
|
; Website store here
|
||||||
|
htdocs=/opt/www/htdocs
|
||||||
|
; tmp dir
|
||||||
|
tmpdir=/opt/www/tmp/
|
||||||
|
; server backlocg
|
||||||
|
backlog=5000
|
||||||
|
; eable or disalbe SSL
|
||||||
|
ssl.enable=0
|
||||||
|
; if SSL is enable, one should specify
|
||||||
|
; the SSL cert and key files
|
||||||
|
; ssl.cert=fullchain.pem
|
||||||
|
; ssl.key=privkey.pem
|
||||||
|
|
||||||
|
; This enable some plugins to be initialised at server startup
|
||||||
|
[AUTOSTART]
|
||||||
|
; to start a plugin at server statup use:
|
||||||
|
;plugin = plugin_name_1
|
||||||
|
;plugin = plugin_name_2, etc
|
||||||
|
|
||||||
|
; sever rules
|
||||||
|
[RULES]
|
||||||
|
; For example the following rule will
|
||||||
|
; convert a request of type:
|
||||||
|
; name.example.com?rq=1
|
||||||
|
;TO:
|
||||||
|
; example.com/name/?rq=1
|
||||||
|
; this is helpful to redirect many sub domains
|
||||||
|
; to a sub folder of the same server
|
||||||
|
; ^([a-zA-Z][a-zA-Z0-9]*)\.[a-zA-Z0-9]+\..*$ = /<1><url>?<query>
|
||||||
|
; Sytax: [regular expression on the original request]=[new request rule]
|
||||||
|
|
||||||
|
[FILEHANDLER]
|
||||||
|
; specify a plugin for handling
|
||||||
|
; a file type
|
||||||
|
; lua page script
|
||||||
|
ls = lua-api
|
||||||
|
; pure lua script
|
||||||
|
lua = lua-api
|
||||||
|
; php and o ther scripting languages can be
|
||||||
|
; handled by the cgi plugin
|
||||||
|
; php = cgi
|
BIN
dist/antd-1.0.4b.tar.gz
vendored
BIN
dist/antd-1.0.4b.tar.gz
vendored
Binary file not shown.
@ -15,7 +15,9 @@
|
|||||||
#define PLUGIN_HANDLER "handle"
|
#define PLUGIN_HANDLER "handle"
|
||||||
#define WS_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
#define WS_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
||||||
#define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0
|
#define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0
|
||||||
#define CONFIG "config.ini"
|
#ifndef CONFIG_FILE
|
||||||
|
#define CONFIG_FILE "antd-config.ini"
|
||||||
|
#endif
|
||||||
|
|
||||||
config_t* config();
|
config_t* config();
|
||||||
void destroy_config();
|
void destroy_config();
|
||||||
|
2
httpd.c
2
httpd.c
@ -117,7 +117,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
// load the config first
|
// load the config first
|
||||||
if(argc==1)
|
if(argc==1)
|
||||||
load_config(CONFIG);
|
load_config(CONFIG_FILE);
|
||||||
else
|
else
|
||||||
load_config(argv[1]);
|
load_config(argv[1]);
|
||||||
unsigned port = config()->port;
|
unsigned port = config()->port;
|
||||||
|
Loading…
Reference in New Issue
Block a user