mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
added for-glob
This commit is contained in:
@@ -6,7 +6,6 @@ a supervisor for multiple uWSGI instances
|
||||
|
||||
*/
|
||||
#include "uwsgi.h"
|
||||
#include <glob.h>
|
||||
|
||||
|
||||
extern struct uwsgi_server uwsgi;
|
||||
|
||||
@@ -1455,6 +1455,25 @@ int uwsgi_logic_opt_for(char *key, char *value) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int uwsgi_logic_opt_for_glob(char *key, char *value) {
|
||||
|
||||
glob_t g;
|
||||
int i;
|
||||
if (glob(uwsgi.logic_opt_data, GLOB_MARK | GLOB_NOCHECK, NULL, &g)) {
|
||||
uwsgi_error("uwsgi_logic_opt_for_glob()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < (int) g.gl_pathc; i++) {
|
||||
add_exported_option(key, uwsgi_substitute(value, "%(_)", g.gl_pathv[i]), 0);
|
||||
}
|
||||
|
||||
globfree(&g);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void add_exported_option(char *key, char *value, int configured) {
|
||||
|
||||
struct uwsgi_string_list *blacklist = uwsgi.blacklist;
|
||||
|
||||
@@ -78,6 +78,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"declare-option", required_argument, 0, "declare a new uWSGI custom option", uwsgi_opt_add_custom_option, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
|
||||
{"for", required_argument, 0, "(opt logic) for cycle", uwsgi_opt_logic, (void *) uwsgi_logic_opt_for, UWSGI_OPT_IMMEDIATE},
|
||||
{"for-glob", required_argument, 0, "(opt logic) for cycle (expand glob)", uwsgi_opt_logic, (void *) uwsgi_logic_opt_for_glob, UWSGI_OPT_IMMEDIATE},
|
||||
{"endfor", optional_argument, 0, "(opt logic) end for cycle", uwsgi_opt_noop, NULL, UWSGI_OPT_IMMEDIATE},
|
||||
|
||||
{"if-opt", required_argument, 0, "(opt logic) check for option", uwsgi_opt_logic, (void *) uwsgi_logic_opt_if_opt, UWSGI_OPT_IMMEDIATE},
|
||||
|
||||
@@ -324,6 +324,9 @@ extern "C" {
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#include <glob.h>
|
||||
|
||||
|
||||
|
||||
struct uwsgi_buffer {
|
||||
char *buf;
|
||||
@@ -3258,19 +3261,20 @@ socklen_t socket_to_in_addr6(char *, char *, int, struct sockaddr_in6 *);
|
||||
void uwsgi_opt_noop(char *, char *, void *);
|
||||
|
||||
void uwsgi_opt_logic(char *, char *, void *);
|
||||
int uwsgi_logic_opt_for(char *, char *);
|
||||
int uwsgi_logic_opt_if_env(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_env(char *, char *);
|
||||
int uwsgi_logic_opt_if_opt(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_opt(char *, char *);
|
||||
int uwsgi_logic_opt_if_exists(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_exists(char *, char *);
|
||||
int uwsgi_logic_opt_if_file(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_file(char *, char *);
|
||||
int uwsgi_logic_opt_if_dir(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_dir(char *, char *);
|
||||
int uwsgi_logic_opt_if_reload(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_reload(char *, char *);
|
||||
int uwsgi_logic_opt_for(char *, char *);
|
||||
int uwsgi_logic_opt_for_glob(char *, char *);
|
||||
int uwsgi_logic_opt_if_env(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_env(char *, char *);
|
||||
int uwsgi_logic_opt_if_opt(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_opt(char *, char *);
|
||||
int uwsgi_logic_opt_if_exists(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_exists(char *, char *);
|
||||
int uwsgi_logic_opt_if_file(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_file(char *, char *);
|
||||
int uwsgi_logic_opt_if_dir(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_dir(char *, char *);
|
||||
int uwsgi_logic_opt_if_reload(char *, char *);
|
||||
int uwsgi_logic_opt_if_not_reload(char *, char *);
|
||||
|
||||
|
||||
#ifdef UWSGI_CAP
|
||||
|
||||
Reference in New Issue
Block a user