unsigned int enable_client_ssl:1;
unsigned int fresh_mount:1;
+ unsigned int any_vhosts:1;
};
static void *
a->info->vhost_name);
return 1;
}
+ a->any_vhosts = 1;
if (a->enable_client_ssl) {
memset(a->info, 0, sizeof(*a->info));
fd = open(f, O_RDONLY);
if (fd < 0) {
lwsl_err("Cannot open %s\n", f);
- return 1;
+ return 2;
}
lwsl_info("%s: %s\n", __func__, f);
lejp_construct(&ctx, cb, user, paths, count_paths);
if (!uv_fs_scandir(&loop, &req, d, 0, NULL)) {
lwsl_err("Scandir on %s failed\n", d);
- return 1;
+ return 2;
}
while (uv_fs_scandir_next(&req, &dent) != UV_EOF) {
{
struct jpargs a;
const char * const *old = info->plugin_dirs;
+ char dd[128];
memset(&a, 0, sizeof(a));
old++;
}
- if (lwsws_get_config(&a, "/etc/lwsws/conf", paths_global,
+ snprintf(dd, sizeof(dd) - 1, "%s/conf", d);
+ if (lwsws_get_config(&a, dd, paths_global,
ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
return 1;
- if (lwsws_get_config_d(&a, d, paths_global,
+ snprintf(dd, sizeof(dd) - 1, "%s/conf.d", d);
+ if (lwsws_get_config_d(&a, dd, paths_global,
ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
return 1;
char **cs, int *len)
{
struct jpargs a;
+ char dd[128];
memset(&a, 0, sizeof(a));
a.protocols = info->protocols;
a.extensions = info->extensions;
- if (lwsws_get_config(&a, "/etc/lwsws/conf", paths_vhosts,
+ snprintf(dd, sizeof(dd) - 1, "%s/conf", d);
+ if (lwsws_get_config(&a, dd, paths_vhosts,
ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
return 1;
- if (lwsws_get_config_d(&a, d, paths_vhosts,
+ snprintf(dd, sizeof(dd) - 1, "%s/conf.d", d);
+ if (lwsws_get_config_d(&a, dd, paths_vhosts,
ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
return 1;
*cs = a.p;
*len = a.end - a.p;
+ if (!a.any_vhosts) {
+ lwsl_err("Need at least one vhost\n");
+ return 1;
+ }
+
lws_finalize_startup(context);
return 0;