Class ConfigLoader

java.lang.Object
io.karatelabs.core.ConfigLoader

public final class ConfigLoader extends Object
Config-only evaluation: evaluate a project's karate-base.js + karate-config.js (+ the env-specific karate-config-<env>.js) for a working dir and return the merged config Map without running any features (no SUITE_ENTER/SUITE_EXIT, no scenarios). The config sibling of BootLoader.bootOnly(java.nio.file.Path, java.lang.String) — so a caller that lives OUTSIDE a run (a persistent serve/loop engine that wants a project's config — base URLs, env selection, secrets — resolved the SAME way karate run / Runner.run resolve it) can get the config map on demand and bind it, instead of hand-injecting individual variables.

Evaluation runs through the normal ScenarioRuntime config phase (a minimal top-level runtime over a synthetic empty scenario), so the full karate.* API — including karate.callSingle and karate.properties/karate.env — is live during config, exactly as in a real run. Fail-loud: a present-but-failing config throws (the same discipline as BootLoader.bootOnly(java.nio.file.Path, java.lang.String)); the caller decides whether to degrade.

  • Method Details

    • configOnly

      public static Map<String,Object> configOnly(Path workingDir, String env)
      Evaluate config for workingDir under env (nullable → the ambient karate.env) and return the merged config variables. Returns an empty map when workingDir is null. Throws when a config file is present but its evaluation fails.