1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Add support for TXT records with multiple strings (BIND, ROUTE53) (#293)

* BIND: Support TXT records with multiple strings (#289)
* ROUTE53: Add support for TXT records with multiple strings (#292)
This commit is contained in:
Tom Limoncelli
2018-01-04 19:19:35 -05:00
committed by GitHub
parent d051f51a59
commit de88bfe8b7
32 changed files with 489 additions and 184 deletions

View File

@ -220,8 +220,32 @@ var TLSA = recordBuilder('TLSA', {
},
});
function isStringOrArray(x) {
return _.isString(x) || _.isArray(x);
}
// TXT(name,target, recordModifiers...)
var TXT = recordBuilder('TXT');
var TXT = recordBuilder("TXT", {
args: [["name", _.isString], ["target", isStringOrArray]],
transform: function(record, args, modifiers) {
record.name = args.name;
// Store the strings twice:
// .target is the first string
// .txtstrings is the individual strings.
// NOTE: If there are more than 1 string, providers should only access
// .txtstrings, thus it doesn't matter what we store in .target.
// However, by storing the first string there, it improves backwards
// compatibility when the len(array) == 1 and (intentionally) breaks
// broken providers early in the integration tests.
if (_.isString(args.target)) {
record.target = args.target;
record.txtstrings = [args.target];
} else {
record.target = args.target[0]
record.txtstrings = args.target;
}
}
});
// MX(name,priority,target, recordModifiers...)
var MX = recordBuilder('MX', {