Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller committed Jan 20, 2025
1 parent efeeaba commit 5b80c3c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/project/connect_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func ConnectGithubFlow(ctx context.Context, ch *cmdutil.Helper, opts *DeployOpts
vars, err := local.ParseDotenv(ctx, localProjectPath)
if err != nil {
ch.PrintfWarn("Failed to parse .env: %v\n", err)
} else {
} else if len(vars) > 0 {
c, err := ch.Client()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/project/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func DeployWithUploadFlow(ctx context.Context, ch *cmdutil.Helper, opts *DeployO
vars, err := local.ParseDotenv(ctx, localProjectPath)
if err != nil {
ch.PrintfWarn("Failed to parse .env: %v\n", err)
} else {
} else if len(vars) > 0 {
_, err = adminClient.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: ch.Org,
Project: opts.Name,
Expand Down Expand Up @@ -256,7 +256,7 @@ func DeployWithUploadFlow(ctx context.Context, ch *cmdutil.Helper, opts *DeployO
vars, err := local.ParseDotenv(ctx, localProjectPath)
if err != nil {
ch.PrintfWarn("Failed to parse .env: %v\n", err)
} else {
} else if len(vars) > 0 {
_, err = adminClient.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: ch.Org,
Project: opts.Name,
Expand Down
32 changes: 18 additions & 14 deletions cli/pkg/local/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,15 @@ func (s *Server) DeployProject(ctx context.Context, r *connect.Request[localv1.D
if err != nil {
return nil, fmt.Errorf("failed to parse .env: %w", err)
}
_, err = c.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: r.Msg.Org,
Project: r.Msg.ProjectName,
Variables: dotenv,
})
if err != nil {
return nil, err
if len(dotenv) > 0 {
_, err = c.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: r.Msg.Org,
Project: r.Msg.ProjectName,
Variables: dotenv,
})
if err != nil {
return nil, err
}
}

return connect.NewResponse(&localv1.DeployProjectResponse{
Expand Down Expand Up @@ -457,13 +459,15 @@ func (s *Server) RedeployProject(ctx context.Context, r *connect.Request[localv1
if err != nil {
return nil, fmt.Errorf("failed to parse .env: %w", err)
}
_, err = c.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: projResp.Project.OrgName,
Project: projResp.Project.Name,
Variables: dotenv,
})
if err != nil {
return nil, err
if len(dotenv) > 0 {
_, err = c.UpdateProjectVariables(ctx, &adminv1.UpdateProjectVariablesRequest{
Organization: projResp.Project.OrgName,
Project: projResp.Project.Name,
Variables: dotenv,
})
if err != nil {
return nil, err
}
}

// TODO : Add other update project fields
Expand Down

0 comments on commit 5b80c3c

Please sign in to comment.