Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cliext/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ func (b *ClientOptionsBuilder) Build(ctx context.Context) (client.Options, error
profile.APIKey = cfg.ApiKey
}

// Set client authority on profile if provided
if cfg.ClientAuthority != "" {
profile.Authority = cfg.ClientAuthority
}

// Handle gRPC metadata from flags.
if len(cfg.GrpcMeta) > 0 {
grpcMetaFromArg, err := parseKeyValuePairs(cfg.GrpcMeta)
Expand Down
6 changes: 1 addition & 5 deletions cliext/config.oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ func resolveConfigAndProfile(configFilePath, profileName string, envLookup envco
configFilePath, _ = envLookup.LookupEnv("TEMPORAL_CONFIG_FILE")
}
if configFilePath == "" {
var err error
configFilePath, err = envconfig.DefaultConfigFilePath()
if err != nil {
return "", "", fmt.Errorf("failed to get default config path: %w", err)
}
configFilePath = envconfig.DefaultConfigFilePath()
}

// Resolve profile name.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/temporalio/ui-server/v2 v2.49.1
go.temporal.io/api v1.62.13
go.temporal.io/sdk v1.44.1
go.temporal.io/sdk/contrib/envconfig v1.0.0
go.temporal.io/sdk/contrib/envconfig v1.0.2
go.temporal.io/server v1.32.0-157.0
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
golang.org/x/mod v0.35.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ go.temporal.io/auto-scaled-workers v0.0.0-20260407181057-edd947d743d2 h1:1hKeH3G
go.temporal.io/auto-scaled-workers v0.0.0-20260407181057-edd947d743d2/go.mod h1:T8dnzVPeO+gaUTj9eDgm/lT2lZH4+JXNvrGaQGyVi50=
go.temporal.io/sdk v1.44.1 h1:Mt2OZLZpqkzDIdg9YyQzO0Rb/HqCDnnqHlIAGAJ5gqM=
go.temporal.io/sdk v1.44.1/go.mod h1:vkApR12F9/Y8OR+hkxe7WyXQFuCX6clhzqnAk6rzDAM=
go.temporal.io/sdk/contrib/envconfig v1.0.0 h1:1Q/swVgB4EW/p3k7rI9/4hpU4/DC57FSRbU90+UisXw=
go.temporal.io/sdk/contrib/envconfig v1.0.0/go.mod h1:Pj4N1lwUEvxap6quBm8GrVMSUMJhSZkVtxjt3AYnPPg=
go.temporal.io/sdk/contrib/envconfig v1.0.2 h1:MGHfsuPUtsf7X9M6WYn3zYJj/mWsuYHnA1uuiL0KEuE=
go.temporal.io/sdk/contrib/envconfig v1.0.2/go.mod h1:MuMiH7hksps2uXnmKuAWaP9P6WbkSDy62kl64t1VJVg=
go.temporal.io/server v1.32.0-157.0 h1:nzFqNwx+5lXsT0/DSiFyR5vHMnDcT3PVAvmRDqCUn38=
go.temporal.io/server v1.32.0-157.0/go.mod h1:a76wf30/s28JXh+3nDQtQi8KzOfRQEddpebvmr/oQL4=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
Expand Down
7 changes: 3 additions & 4 deletions internal/temporalcli/commands.config.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ var envConfigPropsToFieldNames = map[string]string{
"address": "Address",
"namespace": "Namespace",
"api_key": "APIKey",
"authority": "Authority",
"tls": "TLS",
"tls.disabled": "Disabled",
"tls.client_cert_path": "ClientCertPath",
Expand Down Expand Up @@ -311,10 +312,8 @@ func writeEnvConfigFile(cctx *CommandContext, conf *envconfig.ClientConfig) erro
if configFile == "" {
configFile, _ = cctx.Options.EnvLookup.LookupEnv("TEMPORAL_CONFIG_FILE")
if configFile == "" {
var err error
if configFile, err = envconfig.DefaultConfigFilePath(); err != nil {
return err
}
configFile = envconfig.DefaultConfigFilePath()

}
}

Expand Down
3 changes: 3 additions & 0 deletions internal/temporalcli/commands.config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestConfig_Get(t *testing.T) {
address = "my-address"
namespace = "my-namespace"
api_key = "my-api-key"
authority = "my-authority"
codec = { endpoint = "my-endpoint", auth = "my-auth" }
grpc_meta = { some-heAder1 = "some-value1", some-header2 = "some-value2", some_heaDer3 = "some-value3" }
some_future_key = "some future value not handled"
Expand Down Expand Up @@ -74,6 +75,7 @@ disable_host_verification = true`))
"address": "my-address",
"namespace": "my-namespace",
"api_key": "my-api-key",
"authority": "my-authority",
"codec.endpoint": "my-endpoint",
"codec.auth": "my-auth",
"grpc_meta.some-header1": "some-value1",
Expand Down Expand Up @@ -117,6 +119,7 @@ disable_host_verification = true`))
h.JSONEq(`{
"address": "my-address",
"api_key": "my-api-key",
"authority": "my-authority",
"codec": {
"auth": "my-auth",
"endpoint": "my-endpoint"
Expand Down
28 changes: 24 additions & 4 deletions internal/temporalcli/commands.schedule.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package temporalcli

import (
"encoding/json"
"errors"
"fmt"
"regexp"
Expand All @@ -16,6 +17,7 @@ import (
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
schedpb "go.temporal.io/api/schedule/v1"
"go.temporal.io/api/temporalproto"
"go.temporal.io/api/workflowservice/v1"
"go.temporal.io/sdk/client"
)
Expand Down Expand Up @@ -48,8 +50,8 @@ type printableSchedule struct {
LastUpdateAt time.Time `cli:",cardOmitEmpty"` // describe only
ActionCounts *actionCounts `cli:",cardOmitEmpty"` // describe only
// SearchAttributes, Memo
SearchAttributes *commonpb.SearchAttributes `cli:",cardOmitEmpty"`
Memo *commonpb.Memo `cli:",cardOmitEmpty"`
SearchAttributes map[string]interface{} `cli:",cardOmitEmpty"`
Memo *commonpb.Memo `cli:",cardOmitEmpty"`
}

type actionCounts struct {
Expand All @@ -69,7 +71,7 @@ func describeResultToPrintable(id string, desc *client.ScheduleDescription) *pri
// ID, SearchAttributes, Memo
out := &printableSchedule{
ScheduleId: id,
SearchAttributes: desc.SearchAttributes,
SearchAttributes: searchAttributesToMap(desc.SearchAttributes),
Memo: desc.Memo,
}
// Schedule.Action
Expand Down Expand Up @@ -114,7 +116,7 @@ func listEntryToPrintable(ent *client.ScheduleListEntry) *printableSchedule {
Paused: ent.Paused,
Notes: ent.Note,
Action: struct{ Workflow string }{Workflow: ent.WorkflowType.Name},
SearchAttributes: ent.SearchAttributes,
SearchAttributes: searchAttributesToMap(ent.SearchAttributes),
Memo: ent.Memo,
}
specToPrintable(out, ent.Spec)
Expand Down Expand Up @@ -640,3 +642,21 @@ func (c *TemporalScheduleListMatchingTimesCommand) run(cctx *CommandContext, arg
Table: &printer.TableOptions{},
})
}

func searchAttributesToMap(sa *commonpb.SearchAttributes) map[string]interface{} {
// Step 1 — handle nil
if sa == nil {
return nil
}
// Step 2 — marshal to JSON bytes using proto marshaler
b, err := temporalproto.CustomJSONMarshalOptions{}.Marshal(sa)
if err != nil {
return nil
}
// Step 3 — unmarshal bytes into plain map
var m map[string]interface{}
if err := json.Unmarshal(b, &m); err != nil {
return nil
}
return m
}