github.com/StackExchange/dnscontrol/v4@v4.11.0/documentation/language-reference/top-level-functions/require_glob.md (about)

     1  ---
     2  name: require_glob
     3  parameters:
     4    - path
     5    - recursive
     6  parameter_types:
     7    path: string
     8    recursive: boolean
     9  ---
    10  
    11  `require_glob()` recursively loads `.js` files that match a glob (wildcard). The recursion can be disabled.
    12  
    13  Possible parameters are:
    14  
    15  - Path as string, where you would like to start including files. Mandatory. Pattern matching possible, see [GoLand path/filepath/#Match docs](https://golang.org/pkg/path/filepath/#Match).
    16  - If being recursive. This is a boolean if the search should be recursive or not. Define either `true` or `false`. Default is `true`.
    17  
    18  Example to load `.js` files recursively:
    19  
    20  {% code title="dnsconfig.js" %}
    21  ```javascript
    22  require_glob("./domains/");
    23  ```
    24  {% endcode %}
    25  
    26  Example to load `.js` files only in `domains/`:
    27  
    28  {% code title="dnsconfig.js" %}
    29  ```javascript
    30  require_glob("./domains/", false);
    31  ```
    32  {% endcode %}
    33  
    34  # Comparison to require()
    35  
    36  `require_glob()` and `require()` both use the same rules for determining which directory path is
    37  relative to.
    38  
    39  This will load files being present underneath `./domains/user1/` and **NOT** at below `./domains/`, as `require_glob()`
    40  is called in the subfolder `domains/`.
    41  
    42  {% code title="dnsconfig.js" %}
    43  ```javascript
    44  require("domains/index.js");
    45  ```
    46  {% endcode %}
    47  
    48  {% code title="domains/index.js" %}
    49  ```javascript
    50  require_glob("./user1/");
    51  ```
    52  {% endcode %}