diff --git a/src/go/rpk/pkg/adminapi/api_transform.go b/src/go/rpk/pkg/adminapi/api_transform.go index a29ee26e5a21..44f9fe5d1a0c 100644 --- a/src/go/rpk/pkg/adminapi/api_transform.go +++ b/src/go/rpk/pkg/adminapi/api_transform.go @@ -59,7 +59,7 @@ type TransformMetadata struct { InputTopic string `json:"input_topic"` OutputTopics []string `json:"output_topics"` Status []PartitionTransformStatus `json:"status,omitempty"` - Environment []EnvironmentVariable `json:"environment"` + Environment []EnvironmentVariable `json:"environment,omitempty"` } // ListWasmTransforms lists the transforms that are running on a cluster. diff --git a/src/go/rpk/pkg/cli/transform/deploy.go b/src/go/rpk/pkg/cli/transform/deploy.go index 45b85c2fca3f..adea42edad9b 100644 --- a/src/go/rpk/pkg/cli/transform/deploy.go +++ b/src/go/rpk/pkg/cli/transform/deploy.go @@ -61,7 +61,7 @@ The --env-var can be repeated to specify multiple variables. fileConfig, err := project.LoadCfg(fs) // We allow users to deploy if they aren't in a directory with transform.yaml // in that case all config needs to be specified on the command line. - if err != nil { + if err == nil { cfg = mergeProjectConfigs(fileConfig, cfg) } err = validateProjectConfig(cfg, err) @@ -192,7 +192,7 @@ func isEmptyProjectConfig(cfg project.Config) bool { func validateProjectConfig(cfg project.Config, fileConfigErr error) error { // If the user just typed `rpk transform deploy` then we assume they expected to take the configuration values from // the file, so print out that error. - if isEmptyProjectConfig(cfg) && fileConfigErr == nil { + if isEmptyProjectConfig(cfg) && fileConfigErr != nil { return fmt.Errorf("unable to find %q: %v", project.ConfigFileName, fileConfigErr) } if cfg.Name == "" { diff --git a/src/v/redpanda/admin_server.cc b/src/v/redpanda/admin_server.cc index 60ea28ffb341..9cfbe2a31dc8 100644 --- a/src/v/redpanda/admin_server.cc +++ b/src/v/redpanda/admin_server.cc @@ -5884,8 +5884,8 @@ admin_server::deploy_transform(std::unique_ptr req) { output_topics.push_back(output_nt); } absl::flat_hash_map env; - if (doc.HasMember("env")) { - for (const auto& e : doc["env"].GetArray()) { + if (doc.HasMember("environment")) { + for (const auto& e : doc["environment"].GetArray()) { auto v = e.GetObject(); env.insert_or_assign(v["key"].GetString(), v["value"].GetString()); }