parseDomains static method

Map<Pattern, Directory> parseDomains(
  1. Object? o, {
  2. APIConfig? apiConfig,
  3. Object? documentRoot,
  4. bool checkDirectoryExistence = false,
})

Parses a set of domains to serve static files.

Implementation

static Map<Pattern, Directory> parseDomains(Object? o,
    {APIConfig? apiConfig,
    Object? documentRoot,
    bool checkDirectoryExistence = false}) {
  o ??= apiConfig?.get('domains');

  var documentRootDir = parseDomainDirectory(documentRoot,
      checkDirectoryExistence: checkDirectoryExistence);

  var domains =
      _parseDomains(o, checkDirectoryExistence: checkDirectoryExistence);

  var domains2 = {
    ...domains,
    if (documentRootDir != null) RegExp(r'.*'): documentRootDir,
  };

  return domains2;
}