diff --git a/app/handler/google.go b/app/handler/google.go index c0b59e9..e69c2b0 100644 --- a/app/handler/google.go +++ b/app/handler/google.go @@ -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)