Hello
Is there a way to get a reference to get a reference to the filename that is currently being require'd (without the .js part)?
I would like to be able to setup domains like this:
D( FILENAME_WITHOUT_JS, [...] )
The reason for this:
I have a somewhat bigger list of domains and do sometimes impulsively buy new ones (I'm sure some people using DNSControl can relate). I have separated all domain definitions into separate files that have the domain's name as filename, e.g. "
example.com" is defined in "example.com.js". My dnscontrol.js file is basically just:
require_glob("./domains/");
I have a script that collects all available domain names using a combination of list-zones and API calls for registrars that are not supported by DNSControl, and compares that to the domain definition files on disk. That way I get a notification if I un-/register a domain and have not yet added it to DNSControl.
And with that reference, I could save a few seconds each time, when copying the parked domain template by not having to replace the domain string in the file. I could just symlink the template, which would make it very easy to separate all parked domains from the in-use ones.
Thanks,
Stefan