diff --git a/.gitignore b/.gitignore index b9df76a..139e1cd 100644 --- a/.gitignore +++ b/.gitignore @@ -67,7 +67,6 @@ libtool config.log config.status config.sub -config.ini.tpl configure aclocal.m4 ltmain.sh diff --git a/Makefile.am b/Makefile.am index 4cfed14..4ecabf2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ else 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 libantd_la_SOURCES = lib/ini.c \ @@ -34,7 +34,7 @@ pkginclude_HEADERS = lib/ini.h \ lib/scheduler.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 if DB libantd_la_SOURCES += lib/dbhelper.c @@ -45,4 +45,12 @@ endif bin_PROGRAMS = antd # lib source files antd_SOURCES = plugin_manager.c http_server.c httpd.c -antd_LDADD = libantd.la \ No newline at end of file +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 \ No newline at end of file diff --git a/antd-config.ini b/antd-config.ini new file mode 100644 index 0000000..cb40a76 --- /dev/null +++ b/antd-config.ini @@ -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>? +; 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 \ No newline at end of file diff --git a/dist/antd-1.0.4b.tar.gz b/dist/antd-1.0.4b.tar.gz index c8f7a27..5172c79 100644 Binary files a/dist/antd-1.0.4b.tar.gz and b/dist/antd-1.0.4b.tar.gz differ diff --git a/http_server.h b/http_server.h index 6ae9cc2..88371bb 100644 --- a/http_server.h +++ b/http_server.h @@ -15,7 +15,9 @@ #define PLUGIN_HANDLER "handle" #define WS_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" #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(); void destroy_config(); diff --git a/httpd.c b/httpd.c index 55c2665..61ad655 100644 --- a/httpd.c +++ b/httpd.c @@ -117,7 +117,7 @@ int main(int argc, char* argv[]) { // load the config first if(argc==1) - load_config(CONFIG); + load_config(CONFIG_FILE); else load_config(argv[1]); unsigned port = config()->port;