-
Notifications
You must be signed in to change notification settings - Fork 270
Labels
Description
Problem
EnvironmentService methods have inconsistent env_name handling:
GetValue,SetValue,GetValuesrequire explicitenv_name(fail if empty)GetConfig,SetConfig, etc. always use default environment (can't target other envs)
Solution
All methods should optionally accept env_name: use specified env if provided, fall back to default if empty.
Changes
1. Proto: Add env_name to Config request messages
In grpc/proto/environment.proto, add env_name as field 1 (shifting existing fields) to:
GetConfigRequestGetConfigStringRequestGetConfigSectionRequestSetConfigRequestUnsetConfigRequest
Mirror changes in extensions/microsoft.azd.extensions/internal/resources/languages/proto/environment.proto.
2. Implementation: Add resolver helper
In internal/grpcserver/environment_service.go, add:
func (s *environmentService) resolveEnvironment(ctx context.Context, envName string) (*environment.Environment, error) {
if envName == "" {
return s.currentEnvironment(ctx)
}
envManager, err := s.lazyEnvManager.GetValue()
if err != nil {
return nil, err
}
return envManager.Get(ctx, envName)
}3. Update all methods to use resolveEnvironment()
Replace direct envManager.Get(ctx, req.EnvName) and s.currentEnvironment(ctx) calls with s.resolveEnvironment(ctx, req.EnvName) in:
GetValueSetValueGetValuesGetConfigGetConfigStringGetConfigSectionSetConfigUnsetConfig
4. Regenerate protos and update tests
Reactions are currently unavailable