diff --git a/pkg/config/conf.gen.go b/pkg/config/conf.gen.go index b3b5f4102..799873c61 100644 --- a/pkg/config/conf.gen.go +++ b/pkg/config/conf.gen.go @@ -1,12 +1,13 @@ // Code generated by baton-sdk. DO NOT EDIT!!! package config -import "reflect" +import "reflect" type TemporalCloud struct { ApiKey string `mapstructure:"api-key"` AllowInsecure bool `mapstructure:"allow-insecure"` DefaultAccountRole string `mapstructure:"default-account-role"` + BaseUrl string `mapstructure:"base-url"` } func (c *TemporalCloud) findFieldByTag(tagValue string) (any, bool) { diff --git a/pkg/config/config.go b/pkg/config/config.go index cffc86438..3761893c1 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -29,12 +29,20 @@ var ( field.WithRequired(false), ) + BaseURLField = field.StringField( + "base-url", + field.WithDescription("Override the Temporal Cloud API URL (for testing)"), + field.WithHidden(true), + field.WithExportTarget(field.ExportTargetCLIOnly), + ) + // ConfigurationFields defines the external configuration required for the // connector to run. ConfigurationFields = []field.SchemaField{ APIKeyField, AllowInsecureField, DefaultAccountRoleField, + BaseURLField, } // FieldRelationships defines relationships between the fields listed in diff --git a/pkg/connector/connector.go b/pkg/connector/connector.go index 1af7a79c1..c6527a23c 100644 --- a/pkg/connector/connector.go +++ b/pkg/connector/connector.go @@ -84,6 +84,9 @@ func (d *Connector) Validate(ctx context.Context) (annotations.Annotations, erro // New returns a new instance of the connector. func New(ctx context.Context, tc *cfg.TemporalCloud, opts *cli.ConnectorOpts) (connectorbuilder.ConnectorBuilderV2, []connectorbuilder.Opt, error) { var clientOpts []client.Opt + if tc.BaseUrl != "" { + clientOpts = append(clientOpts, client.WithAPIAddress(tc.BaseUrl)) + } if tc.AllowInsecure { clientOpts = append(clientOpts, client.AllowInsecure()) }