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
5 changes: 5 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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for the config set path ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spkane31 Sure, I'll add a test for the config set path in the next commit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spkane31 Added test for config set path in the latest commit.

"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 Expand Up @@ -320,6 +323,7 @@ func TestConfig_Set(t *testing.T) {
"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 @@ -350,6 +354,7 @@ func TestConfig_Set(t *testing.T) {
"address": "my-address",
"namespace": "my-namespace",
"api_key": "my-api-key",
"authority": "my-authority",
"tls": map[string]any{
"disabled": true,
"client_cert_path": "my-client-cert-path",
Expand Down