Self Checks
To make sure we get to you in time, please check the following :)
Is your feature request related to a problem? Please describe.
In dify-plugin-daemon/internal/core/local_runtime/setup_python_environment.go, [exec.CommandContext] creates a child process, but apend overwrites all environment variables of the main process. This prevents me from passing in my own Nexus account&pwd&certificate and related configuration parameters, such as UV_INDEX_NEXUS_USERNAME and UV_INDEX_NEXUS_PASWORD and SSL_CERT_FILE, which I cannot use correctly. Therefore, is it possible to enhance this so that UV can inherit the parent process's environment variables when it starts?
Source code:
`
log.Info("uv command", "cmd", uvPath, "args", args)
virtualEnvPath := path.Join(p.State.WorkingPath, ".venv")
uvCacheDir := path.Join(p.appConfig.PluginWorkingPath, ".uv-cache")
cmd := exec.CommandContext(ctx, uvPath, args...)
parent.SetAttributes(attribute.String("uv.path", uvPath), attribute.StringSlice("uv.args", args))
cmd.Env = append(cmd.Env, "VIRTUAL_ENV="+virtualEnvPath, "PATH="+os.Getenv("PATH"))
cmd.Env = append(cmd.Env, "UV_CACHE_DIR="+uvCacheDir)
if p.appConfig.HttpProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("HTTP_PROXY=%s", p.appConfig.HttpProxy))
}
if p.appConfig.HttpsProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("HTTPS_PROXY=%s", p.appConfig.HttpsProxy))
}
if p.appConfig.NoProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("NO_PROXY=%s", p.appConfig.NoProxy))
}
cmd.Dir = p.State.WorkingPath`
Describe the solution you'd like
Modify code:
`
log.Info("uv command", "cmd", uvPath, "args", args)
virtualEnvPath := path.Join(p.State.WorkingPath, ".venv")
uvCacheDir := path.Join(p.appConfig.PluginWorkingPath, ".uv-cache")
cmd := exec.CommandContext(ctx, uvPath, args...)
parent.SetAttributes(attribute.String("uv.path", uvPath), attribute.StringSlice("uv.args", args))
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "VIRTUAL_ENV="+virtualEnvPath, "PATH="+os.Getenv("PATH"))
cmd.Env = append(cmd.Env, "UV_CACHE_DIR="+uvCacheDir)
if p.appConfig.HttpProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("HTTP_PROXY=%s", p.appConfig.HttpProxy))
}
if p.appConfig.HttpsProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("HTTPS_PROXY=%s", p.appConfig.HttpsProxy))
}
if p.appConfig.NoProxy != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("NO_PROXY=%s", p.appConfig.NoProxy))
}
cmd.Dir = p.State.WorkingPath`
`
Describe alternatives you've considered
If inheriting all parent class variables results in conflicts, is it possible to only import custom environment variables and skip the rest?
Additional context
Version: 0.6.3
My main reason is that I want to configure my account password in GCP Secret Manager and don't want it to be exposed, while also being able to use the company's own Nexus repository.
Self Checks
To make sure we get to you in time, please check the following :)
Is your feature request related to a problem? Please describe.
In dify-plugin-daemon/internal/core/local_runtime/setup_python_environment.go, [exec.CommandContext] creates a child process, but
apendoverwrites all environment variables of the main process. This prevents me from passing in my own Nexus account&pwd&certificate and related configuration parameters, such asUV_INDEX_NEXUS_USERNAMEandUV_INDEX_NEXUS_PASWORDandSSL_CERT_FILE, which I cannot use correctly. Therefore, is it possible to enhance this so that UV can inherit the parent process's environment variables when it starts?Source code:
`
Describe the solution you'd like
Modify code:
`
`
Describe alternatives you've considered
If inheriting all parent class variables results in conflicts, is it possible to only import custom environment variables and skip the rest?
Additional context
Version: 0.6.3
My main reason is that I want to configure my account password in GCP Secret Manager and don't want it to be exposed, while also being able to use the company's own Nexus repository.