fr_time_delta_t reconnection_delay;
char const *log_prefix;
+
+ bool triggers; //!< Do we run triggers.
} fr_redis_conf_t;
#define REDIS_COMMON_CONFIG \
{ FR_CONF_OFFSET_FLAGS("password", CONF_FLAG_SECRET, fr_redis_conf_t, password) }, \
{ FR_CONF_OFFSET("max_nodes", fr_redis_conf_t, max_nodes), .dflt = "20" }, \
{ FR_CONF_OFFSET("max_alt", fr_redis_conf_t, max_alt), .dflt = "3" }, \
- { FR_CONF_OFFSET("max_redirects", fr_redis_conf_t, max_redirects), .dflt = "2" }
+ { FR_CONF_OFFSET("max_redirects", fr_redis_conf_t, max_redirects), .dflt = "2" }, \
+ { FR_CONF_OFFSET("triggers", fr_redis_conf_t, triggers) }
void fr_redis_version_print(void);
* @param module Configuration section to search for 'server' conf pairs in.
* @param conf Base redis server configuration. Cluster nodes share database
* number and password.
- * @param triggers_enabled Whether triggers should be enabled.
* @param log_prefix Custom log prefix. Defaults to @verbatim rlm_<module> (<instance>) @endverbatim.
* @param trigger_prefix Custom trigger prefix. Defaults to @verbatim modules.<module>.pool @endverbatim.
* @param trigger_args Argument pairs to pass to the trigger in addition to Connection-Pool-Server,
fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
CONF_SECTION *module,
fr_redis_conf_t *conf,
- bool triggers_enabled,
char const *log_prefix,
char const *trigger_prefix,
fr_pair_list_t *trigger_args)
uint64_t num_nodes;
fr_redis_cluster_t *cluster;
- fr_assert(triggers_enabled || !trigger_prefix);
- fr_assert(triggers_enabled || (!trigger_args || fr_pair_list_empty(trigger_args)));
-
MEM(cluster = talloc_zero(NULL, fr_redis_cluster_t));
fr_pair_list_init(&cluster->trigger_args);
cs_name1 = cf_section_name1(module);
cs_name2 = cf_section_name2(module);
- cluster->triggers_enabled = triggers_enabled;
+ cluster->triggers_enabled = conf->triggers;
if (cluster->triggers_enabled) {
/*
* Setup trigger prefix
fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
CONF_SECTION *module,
fr_redis_conf_t *conf,
- bool enable_triggers,
char const *log_prefix,
char const *trigger_prefix,
fr_pair_list_t *trigger_args);
snprintf(buffer, sizeof(buffer), "rlm_cache (%s)", mctx->mi->parent->name);
- driver->cluster = fr_redis_cluster_alloc(driver, mctx->mi->conf, &driver->conf, true,
+ driver->cluster = fr_redis_cluster_alloc(driver, mctx->mi->conf, &driver->conf,
buffer, "modules.cache.pool", NULL);
if (!driver->cluster) {
ERROR("Cluster failure");
fr_socket_t *nodes;
int ret, i;
- inst->cluster = fr_redis_cluster_alloc(inst, mctx->mi->conf, &inst->conf, true, NULL, NULL, NULL);
+ inst->cluster = fr_redis_cluster_alloc(inst, mctx->mi->conf, &inst->conf, NULL, NULL, NULL);
if (!inst->cluster) return -1;
/*
fr_assert(subcs);
- inst->cluster = fr_redis_cluster_alloc(inst, subcs, &inst->conf, true, NULL, NULL, NULL);
+ inst->cluster = fr_redis_cluster_alloc(inst, subcs, &inst->conf, NULL, NULL, NULL);
if (!inst->cluster) return -1;
if (!fr_redis_cluster_min_version(inst->cluster, "3.0.2")) {
return -1;
}
- this->cluster = fr_redis_cluster_alloc(this, conf, &this->conf, false,
+ /*
+ * Triggers won't work from the tool
+ */
+ this->conf.triggers = false;
+ this->cluster = fr_redis_cluster_alloc(this, conf, &this->conf,
"rlm_redis_ippool_tool", NULL, NULL);
if (!this->cluster) {
talloc_free(this);
rlm_rediswho_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_rediswho_t);
CONF_SECTION *conf = mctx->mi->conf;
- inst->cluster = fr_redis_cluster_alloc(inst, conf, &inst->conf, true, NULL, NULL, NULL);
+ inst->cluster = fr_redis_cluster_alloc(inst, conf, &inst->conf, NULL, NULL, NULL);
if (!inst->cluster) return -1;
return 0;