From b57290a309de3ec27a24948626302909c7eb3e62 Mon Sep 17 00:00:00 2001 From: Yuanlin Lin Date: Thu, 24 Oct 2024 16:59:44 +0800 Subject: [PATCH] fix: domain --- internal/cmd/template/deploy/deploy.go | 6 +++--- pkg/api/domain.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cmd/template/deploy/deploy.go b/internal/cmd/template/deploy/deploy.go index 68aab10..d8a8b33 100644 --- a/internal/cmd/template/deploy/deploy.go +++ b/internal/cmd/template/deploy/deploy.go @@ -190,7 +190,7 @@ func runDeploy(f *cmdutil.Factory, opts *Options) error { f.Log.Infof("Template successfully deployed into project %q (https://dash.zeabur.com/projects/%s).", res.Name, res.ID) - if d, ok := vars["PUBLIC_DOMAIN"]; ok { + if d, ok := vars["PUBLIC_DOMAIN"]; ok && len(project.Region.ID) == 4 && project.Region.ID != "sha1" { s = spinner.New(cmdutil.SpinnerCharSet, cmdutil.SpinnerInterval, spinner.WithColor(cmdutil.SpinnerColor), spinner.WithSuffix(" Waiting service status ..."), @@ -206,14 +206,14 @@ func runDeploy(f *cmdutil.Factory, opts *Options) error { } time.Sleep(2 * time.Second) - get, err := http.Get(fmt.Sprintf("https://%s.zeabur.app/", d)) + get, err := http.Get(fmt.Sprintf("https://%s.%s.zeabur.app/", d, project.Region.ID)) if err != nil { continue } if get.StatusCode%100 != 5 { s.Stop() - f.Log.Infof("Service ready, you can now visit via https://%s.zeabur.app/", d) + f.Log.Infof("Service ready, you can now visit via https://%s.%s.zeabur.app/", d, project.Region.ID) break } diff --git a/pkg/api/domain.go b/pkg/api/domain.go index c093c61..1fc50af 100644 --- a/pkg/api/domain.go +++ b/pkg/api/domain.go @@ -91,7 +91,7 @@ func (c *client) CheckDomainAvailable(ctx context.Context, domain string, isGene CheckDomainAvailable struct { IsAvailable bool Reason string - } `graphql:"checkDomainAvailable(domain: $domain, isGenerated: $isGenerated)"` + } `graphql:"checkDomainAvailable(domain: $domain, isGenerated: $isGenerated, region: $region)"` } err := c.Mutate(ctx, &mutation, V{