Skip to content

Commit 386710d

Browse files
authored
Auto-load required secrets from secrets manager, if they exist (#1335)
Use case for this feature We want to enable a "no args" experience when using MCP servers locally, where thv run {{server_name}} will result in a successful start of the server with no additional flags/arguments needs. A gap in the functionality required to accomplish this is the inability to specify a default behavior for secret environment variables. Within a custom registry, default values may be specified for non-secret environment variables within the ImageMetadata for each server. There is no similar functionality for secret environment variables. This PR addresses this gap by finding required secret environment variables values in the secrets manager. I think this solution is imperfect, and maybe should be optional. I have created this PR to get feedback on the feature gap and proposed solution.
1 parent 586202b commit 386710d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/runner/env.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ func (*CLIEnvVarValidator) Validate(
101101
}
102102

103103
if envVar.Required {
104+
105+
if envVar.Secret {
106+
value, err := secretsManager.GetSecret(ctx, envVar.Name)
107+
if err != nil {
108+
logger.Warnf("Unable to find secret %s in the secrets manager: %v", envVar.Name, err)
109+
} else {
110+
addNewVariable(ctx, envVar, value, secretsManager, &envVars, &secretsList)
111+
continue
112+
}
113+
}
114+
104115
value, err := promptForEnvironmentVariable(envVar)
105116
if err != nil {
106117
logger.Warnf("Warning: Failed to read input for %s: %v", envVar.Name, err)

0 commit comments

Comments
 (0)