diff options
author | Andy Green <andy@warmcat.com> | 2016-05-02 10:03:25 +0800 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2016-05-02 10:03:25 +0800 |
commit | cae57ad98dc8fdbf90f75ee2213cf7af47eabcc2 (patch) | |
tree | 9d9a42a64558a42ac5fa40b1f1e4b4c147e3cd5c /lwsws/main.c | |
parent | 4d5ac9c910554259d919ed41b006cc05f2f1e916 (diff) | |
download | libwebsockets-cae57ad98dc8fdbf90f75ee2213cf7af47eabcc2.tar.gz |
plugins_dir convert to array
If OOT lws plugins will be packaged as separate projects,
they're going to want to install their plugins somewhere
that makes sense for the package instead of one big lws
plugin dir.
This patch changes info to have a const char ** to a NULL
terminated array of directories it should search for
plugins. lwsws knows about this and you can add to the
dir array using config fragments like
{
"global": {
"plugin-dir": "/usr/local/share/coherent-timeline/plugins"
}
}
if the config fragment in /etc/lwsws/conf.d/ is also managed by the
package with the plugin, it can very cleanly add and remove itself
from lwsws based on package install status.
Signed-off-by: Andy Green <andy@warmcat.com>
Diffstat (limited to 'lwsws/main.c')
-rw-r--r-- | lwsws/main.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lwsws/main.c b/lwsws/main.c index 8d84552b..2a7579fc 100644 --- a/lwsws/main.c +++ b/lwsws/main.c @@ -80,6 +80,11 @@ static const struct lws_extension exts[] = { { NULL, NULL, NULL /* terminator */ } }; +static const char * const plugin_dirs[] = { + INSTALL_DATADIR"/libwebsockets-test-server/plugins/", + NULL +}; + static struct option options[] = { { "help", no_argument, NULL, 'h' }, { "debug", required_argument, NULL, 'd' }, @@ -107,6 +112,8 @@ void signal_cb(uv_signal_t *watcher, int signum) } #endif + + int main(int argc, char **argv) { struct lws_context_creation_info info; @@ -184,8 +191,7 @@ int main(int argc, char **argv) LWS_SERVER_OPTION_EXPLICIT_VHOSTS | LWS_SERVER_OPTION_LIBUV; - info.plugins_dir = INSTALL_DATADIR"/libwebsockets-test-server/plugins/"; - + info.plugin_dirs = plugin_dirs; lwsl_notice("Using config dir: \"%s\"\n", config_dir); /* |