Masking: Change "rules_file" parameter to "rules"
The firewall filter and the cache have similar rules files and they use "rules". To be consistent, the masking filter should use "rules" as well.
This commit is contained in:
parent
ead0d4fe3e
commit
47d21bd519
@ -73,7 +73,7 @@ configuration setup.
|
||||
[Mask-SSN]
|
||||
type=filter
|
||||
module=masking
|
||||
rules_file=...
|
||||
rules=...
|
||||
|
||||
[SomeService]
|
||||
type=service
|
||||
@ -83,9 +83,9 @@ filters=Mask-SSN
|
||||
|
||||
## Filter Parameters
|
||||
|
||||
The masking filter has one mandatory parameter - `rules_file`.
|
||||
The masking filter has one mandatory parameter - `rules`.
|
||||
|
||||
#### `rules_file`
|
||||
#### `rules`
|
||||
|
||||
Specifies the path of the file where the masking rules are stored.
|
||||
A relative path is interpreted relative to the _module configuration directory_
|
||||
@ -93,7 +93,7 @@ of MariaDB MaxScale. The default module configuration directory is
|
||||
_/etc/maxscale.modules.d_.
|
||||
|
||||
```
|
||||
rules_file=/path/to/rules-file
|
||||
rules=/path/to/rules-file
|
||||
```
|
||||
|
||||
#### `warn_type_mismatch`
|
||||
|
@ -84,7 +84,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{ Config::rules_file_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED },
|
||||
{ Config::rules_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED },
|
||||
{ Config::warn_type_mismatch_name,
|
||||
MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default,
|
||||
MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values },
|
||||
@ -120,7 +120,7 @@ MaskingFilter* MaskingFilter::create(const char* zName, char** pzOptions, CONFIG
|
||||
|
||||
Config config(zName, pParams);
|
||||
|
||||
auto_ptr<MaskingRules> sRules = MaskingRules::load(config.rules_file().c_str());
|
||||
auto_ptr<MaskingRules> sRules = MaskingRules::load(config.rules().c_str());
|
||||
|
||||
if (sRules.get())
|
||||
{
|
||||
@ -155,7 +155,7 @@ std::tr1::shared_ptr<MaskingRules> MaskingFilter::rules() const
|
||||
|
||||
void MaskingFilter::reload(DCB* pOut)
|
||||
{
|
||||
auto_ptr<MaskingRules> sRules = MaskingRules::load(m_config.rules_file().c_str());
|
||||
auto_ptr<MaskingRules> sRules = MaskingRules::load(m_config.rules().c_str());
|
||||
|
||||
if (sRules.get())
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace
|
||||
{
|
||||
|
||||
const char config_name_large_payload[] = "large_payload";
|
||||
const char config_name_rules_file[] = "rules_file";
|
||||
const char config_name_rules[] = "rules";
|
||||
const char config_name_warn_type_mismatch[] = "warn_type_mismatch";
|
||||
|
||||
const char config_value_abort[] = "abort";
|
||||
@ -47,11 +47,11 @@ const MXS_ENUM_VALUE MaskingFilterConfig::large_payload_values[] =
|
||||
const char* MaskingFilterConfig::large_payload_default = config_value_abort;
|
||||
|
||||
/*
|
||||
* PARAM rules_file
|
||||
* PARAM rules
|
||||
*/
|
||||
|
||||
//static
|
||||
const char* MaskingFilterConfig::rules_file_name = config_name_rules_file;
|
||||
const char* MaskingFilterConfig::rules_name = config_name_rules;
|
||||
|
||||
/*
|
||||
* PARAM warn_type_mismatch
|
||||
@ -84,9 +84,9 @@ MaskingFilterConfig::get_large_payload(const CONFIG_PARAMETER* pParams)
|
||||
}
|
||||
|
||||
//static
|
||||
std::string MaskingFilterConfig::get_rules_file(const CONFIG_PARAMETER* pParams)
|
||||
std::string MaskingFilterConfig::get_rules(const CONFIG_PARAMETER* pParams)
|
||||
{
|
||||
return config_get_string(pParams, rules_file_name);
|
||||
return config_get_string(pParams, rules_name);
|
||||
}
|
||||
|
||||
//static
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
static const MXS_ENUM_VALUE large_payload_values[];
|
||||
static const char* large_payload_default;
|
||||
|
||||
static const char* rules_file_name;
|
||||
static const char* rules_name;
|
||||
|
||||
static const char* warn_type_mismatch_name;
|
||||
static const MXS_ENUM_VALUE warn_type_mismatch_values[];
|
||||
@ -45,7 +45,7 @@ public:
|
||||
MaskingFilterConfig(const char* zName, const CONFIG_PARAMETER* pParams)
|
||||
: m_name(zName)
|
||||
, m_large_payload(get_large_payload(pParams))
|
||||
, m_rules_file(get_rules_file(pParams))
|
||||
, m_rules(get_rules(pParams))
|
||||
, m_warn_type_mismatch(get_warn_type_mismatch(pParams))
|
||||
{}
|
||||
~MaskingFilterConfig() {}
|
||||
@ -60,9 +60,9 @@ public:
|
||||
return m_large_payload;
|
||||
}
|
||||
|
||||
const std::string& rules_file() const
|
||||
const std::string& rules() const
|
||||
{
|
||||
return m_rules_file;
|
||||
return m_rules;
|
||||
}
|
||||
|
||||
warn_type_mismatch_t warn_type_mismatch() const
|
||||
@ -75,9 +75,9 @@ public:
|
||||
m_large_payload = l;
|
||||
}
|
||||
|
||||
void set_rules_file(const std::string& s)
|
||||
void set_rules(const std::string& s)
|
||||
{
|
||||
m_rules_file = s;
|
||||
m_rules = s;
|
||||
}
|
||||
void set_warn_type_mismatch(warn_type_mismatch_t w)
|
||||
{
|
||||
@ -85,12 +85,12 @@ public:
|
||||
}
|
||||
|
||||
static large_payload_t get_large_payload(const CONFIG_PARAMETER* pParams);
|
||||
static std::string get_rules_file(const CONFIG_PARAMETER* pParams);
|
||||
static std::string get_rules(const CONFIG_PARAMETER* pParams);
|
||||
static warn_type_mismatch_t get_warn_type_mismatch(const CONFIG_PARAMETER* pParams);
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
large_payload_t m_large_payload;
|
||||
std::string m_rules_file;
|
||||
std::string m_rules;
|
||||
warn_type_mismatch_t m_warn_type_mismatch;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user