Skip to content

Allow splitting of config into multiple files #51

@captncraig

Description

@captncraig

From twitter:

@Nick_Craver with dnscontrol is there a recommended approach for a global.js (providers/vars) + a single .js file for each domain?

— Brandon Potter (@BrandonPotter) March 20, 2017

I agree this might be a useful feature. Currently the javascript is processed by the following process, using https://github.com/robertkrimen/otto as its javascript interpreter:

  1. Load and run the built in code from helpers.js.
  2. Load and run your user code from dnsconfig.js.
  3. Run a small script to jsonify and dump your config object to be read in go.

It may be possible to have some kind of built in mechanism for combining / importing other js files if your config is large and complicated.

Possibly require("otherfile.js") or import("otherfile.js"). It would simply act as string replacement, replacing the import statement with the contents of the specified file before running.

This is not a commitment to implement this, only a place for discussion. Please state cases for or against such a scheme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DiscussionCommunity discussion about design, features, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions