fix response url

This commit is contained in:
Asim Aslam
2021-12-20 19:57:57 +00:00
parent 3a4efed6c7
commit f3be4be557

View File

@@ -331,6 +331,18 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
}
}
// make copy
srv := new(pb.Service)
*srv = *service
// set the custom domain
if len(e.domain) > 0 {
srv.Url = fmt.Sprintf("https://%s.%s", srv.Id, e.domain)
}
// set the service in the response
rsp.Service = srv
go func(service *pb.Service) {
// generate a unique service account for the app
// https://jsoverson.medium.com/how-to-deploy-node-js-functions-to-google-cloud-8bba05e9c10a
@@ -399,9 +411,6 @@ func (e *GoogleApp) Run(ctx context.Context, req *pb.RunRequest, rsp *pb.RunResp
}
}(service)
// set the service in the response
rsp.Service = service
return nil
}
@@ -555,6 +564,10 @@ func (e *GoogleApp) Delete(ctx context.Context, req *pb.DeleteRequest, rsp *pb.D
return err
}
if srv.Status == "Deploying" {
return errors.BadRequest("app.run", "app is being deployed")
}
// execute the delete async
go func(srv *pb.Service) {
cmd := exec.Command("gcloud", "--quiet", "--project", e.project, "run", "services", "delete", "--region", srv.Region, srv.Id)