Skip to content

feat(docker): use env vars for configDir and port on Imposter 5.x+#124

Merged
outofcoffee merged 3 commits into
mainfrom
feat/docker-5x-env-config
May 21, 2026
Merged

feat(docker): use env vars for configDir and port on Imposter 5.x+#124
outofcoffee merged 3 commits into
mainfrom
feat/docker-5x-env-config

Conversation

@outofcoffee
Copy link
Copy Markdown
Contributor

Switch the Docker engine to set configDir and port via environment variables when running Imposter 5.x or later.

Summary

  • Detect the engine version with semver and pick the right wiring: --configDir / --listenPort CLI flags for 4.x and earlier, IMPOSTER_CONFIG_DIR / IMPOSTER_PORT env vars for 5.x+.
  • Unparseable versions (e.g. dev) default to the env-var form so ongoing development tracks the new interface.

Implementation details

Imposter 5.x removed the --configDir and --listenPort CLI flags, so passing them as Cmd args breaks startup against newer images. The version check uses the existing coreos/go-semver dependency. When the env-var path is taken, Cmd is left empty and the container falls back to the image's default entrypoint args.

Imposter 5.x dropped the --configDir and --listenPort CLI flags in
favour of the IMPOSTER_CONFIG_DIR and IMPOSTER_PORT environment
variables. Detect the engine version with semver and switch between
CLI flags (4.x and earlier) and env vars (5.x+). Unparseable versions
such as "dev" use the env-var form.
@outofcoffee outofcoffee added the enhancement New feature or request label May 21, 2026
@outofcoffee outofcoffee self-assigned this May 21, 2026
Add unit tests for usesEnvConfig, buildCmd, and buildEnv covering 3.x,
4.x, 5.x, 6.x, pre-release, unparseable, and file-cache combinations.
@outofcoffee outofcoffee merged commit 50b24f4 into main May 21, 2026
8 checks passed
@outofcoffee outofcoffee deleted the feat/docker-5x-env-config branch May 21, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant