Skip to content

Add rawsetenv message type for provider plugins#13742

Open
rajyan wants to merge 1 commit intodocker:mainfrom
rajyan:13727-rawsetenv
Open

Add rawsetenv message type for provider plugins#13742
rajyan wants to merge 1 commit intodocker:mainfrom
rajyan:13727-rawsetenv

Conversation

@rajyan
Copy link
Copy Markdown

@rajyan rajyan commented Apr 16, 2026

What I did

Added a new rawsetenv message type to the provider plugin protocol. This allows providers to inject environment variables into dependent services without the automatic service name prefix.

Currently, setenv always prefixes variables with the service name (e.g., URL becomes DATABASE_URL). This works well for connection strings, but some applications require exact variable names that cannot be altered. There is no way to inject these as-is today.

With this change, providers can choose per-variable whether to use the prefixed (setenv) or unprefixed (rawsetenv) behavior:

{"type": "setenv", "message": "URL=https://example.com"}
{"type": "rawsetenv", "message": "SECRET_KEY=xxx"}

Changes

  • pkg/compose/plugins.go — Add RawSetEnvType constant and pluginVariables struct to separate prefixed/raw variables
  • docs/extension.md — Document rawsetenv in the protocol specification
  • docs/examples/provider.go — Add rawsetenv usage to the example provider
  • pkg/e2e/providers_test.go — Test for single-provider rawsetenv and multi-provider rawsetenv
  • pkg/e2e/fixtures/providers/rawsetenv.yaml — Test fixture

Related issue

resolves #13727

Providers can now send rawsetenv messages to inject environment
variables into dependent services without the automatic service name
prefix. This enables use cases where applications require exact
variable names that cannot be altered.

Closes docker#13727

Signed-off-by: Yohta Kimura <38206553+rajyan@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rajyan rajyan requested a review from a team as a code owner April 16, 2026 08:20
@rajyan rajyan requested review from glours and ndeloof April 16, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider services: cannot inject environment variables without service name prefix

1 participant