Skip to content

Commit

Permalink
alter api url name
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Dec 12, 2023
1 parent 5e9ea4f commit 7a9428c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func Execute(ctx context.Context) {
if apiUrl == "" {
apiUrl = cloud.DefaultApiUrl
}
serverlessApiUrl := config.GetNewApiUrl()
if serverlessApiUrl == "" {
serverlessApiUrl = cloud.DefaultServerlessApiUrl
serverlessEndpoint := config.GetServerlessEndpoint()
if serverlessEndpoint == "" {
serverlessEndpoint = cloud.DefaultServerlessEndpoint
}
delegate, err := cloud.NewClientDelegate(publicKey, privateKey, apiUrl, serverlessApiUrl)
delegate, err := cloud.NewClientDelegate(publicKey, privateKey, apiUrl, serverlessEndpoint)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ func (p *Profile) GetApiUrl() (apiUrl string) {
return
}

func GetNewApiUrl() (apiUrl string) { return activeProfile.GetNewApiUrl() }
func (p *Profile) GetNewApiUrl() (newApiUrl string) {
newApiUrl = viper.GetString(fmt.Sprintf("%s.%s", p.name, prop.NewApiUrl))
func GetServerlessEndpoint() (apiUrl string) { return activeProfile.GetServerlessEndpoint() }
func (p *Profile) GetServerlessEndpoint() (newApiUrl string) {
newApiUrl = viper.GetString(fmt.Sprintf("%s.%s", p.name, prop.ServerlessEndpoint))
return
}
12 changes: 6 additions & 6 deletions internal/prop/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
)

const (
PublicKey string = "public-key"
PrivateKey string = "private-key"
CurProfile string = "current-profile"
ApiUrl string = "api-url"
NewApiUrl string = "new-api-url"
TelemetryEnabled string = "telemetry-enabled"
PublicKey string = "public-key"
PrivateKey string = "private-key"
CurProfile string = "current-profile"
ApiUrl string = "api-url"
ServerlessEndpoint string = "serverless-endpoint"
TelemetryEnabled string = "telemetry-enabled"
)

func GlobalProperties() []string {
Expand Down
6 changes: 3 additions & 3 deletions internal/service/cloud/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import (
)

const (
DefaultApiUrl = "https://" + apiClient.DefaultHost
DefaultServerlessApiUrl = "https://" + serverlessClient.DefaultHost
userAgent = "User-Agent"
DefaultApiUrl = "https://" + apiClient.DefaultHost
DefaultServerlessEndpoint = "https://" + serverlessClient.DefaultHost
userAgent = "User-Agent"
)

type TiDBCloudClient interface {
Expand Down

0 comments on commit 7a9428c

Please sign in to comment.