mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
FEATURE: Add rTypes restrictions to IGNORE_NAME (#1808)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
@@ -584,10 +584,13 @@ function IGNORE(name) {
|
||||
return IGNORE_NAME(name);
|
||||
}
|
||||
|
||||
// IGNORE_NAME(name)
|
||||
function IGNORE_NAME(name) {
|
||||
// IGNORE_NAME(name, rTypes)
|
||||
function IGNORE_NAME(name, rTypes) {
|
||||
if (rTypes === undefined) {
|
||||
rTypes = "*";
|
||||
}
|
||||
return function(d) {
|
||||
d.ignored_names.push(name);
|
||||
d.ignored_names.push({pattern: name, types: rTypes});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -600,7 +603,7 @@ var IGNORE_NAME_DISABLE_SAFETY_CHECK = {
|
||||
// See https://github.com/StackExchange/dnscontrol/issues/1106
|
||||
};
|
||||
|
||||
// IGNORE_TARGET(target)
|
||||
// IGNORE_TARGET(target, rType)
|
||||
function IGNORE_TARGET(target, rType) {
|
||||
return function(d) {
|
||||
d.ignored_targets.push({pattern: target, type: rType});
|
||||
|
||||
@@ -35,7 +35,7 @@ var currentDirectory string
|
||||
// EnableFetch sets whether to enable fetch() in JS execution environment
|
||||
var EnableFetch bool = false
|
||||
|
||||
// ExecuteJavascript accepts a javascript string and runs it, returning the resulting dnsConfig.
|
||||
// ExecuteJavascript accepts a javascript file and runs it, returning the resulting dnsConfig.
|
||||
func ExecuteJavascript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) {
|
||||
script, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
D("foo.com", "none"
|
||||
, IGNORE_NAME("testignore")
|
||||
, IGNORE_NAME("testignore2", "A")
|
||||
, IGNORE_NAME("testignore3", "A, CNAME, TXT")
|
||||
, IGNORE_NAME("testignore4", "*")
|
||||
, IGNORE_TARGET("testtarget", "CNAME")
|
||||
, IGNORE("legacyignore")
|
||||
, IGNORE_NAME("@")
|
||||
|
||||
@@ -4,9 +4,30 @@
|
||||
{
|
||||
"dnsProviders": {},
|
||||
"ignored_names": [
|
||||
"testignore",
|
||||
"legacyignore",
|
||||
"@"
|
||||
{
|
||||
"pattern": "testignore",
|
||||
"types": "*"
|
||||
},
|
||||
{
|
||||
"pattern": "testignore2",
|
||||
"types": "A"
|
||||
},
|
||||
{
|
||||
"pattern": "testignore3",
|
||||
"types": "A, CNAME, TXT"
|
||||
},
|
||||
{
|
||||
"pattern": "testignore4",
|
||||
"types": "*"
|
||||
},
|
||||
{
|
||||
"pattern": "legacyignore",
|
||||
"types": "*"
|
||||
},
|
||||
{
|
||||
"pattern": "@",
|
||||
"types": "*"
|
||||
}
|
||||
],
|
||||
"ignored_targets": [
|
||||
{
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
"dnsProviders": {},
|
||||
"records": [],
|
||||
"ignored_names": [
|
||||
"\\*.testignore"
|
||||
{
|
||||
"pattern": "\\*.testignore",
|
||||
"types": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user