Skip to content

Commit

Permalink
Show hibernation TTL in project details in CLI (#2780)
Browse files Browse the repository at this point in the history
* adding prod ttl to project details

* updated dto

* review changes

* review fix
  • Loading branch information
rakeshsharma14317 committed Jul 18, 2023
1 parent d4eceff commit 8a70dfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions admin/server/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ func (s *Server) projToDTO(p *database.Project, orgName string) *adminv1.Project
Subpath: p.Subpath,
GithubUrl: safeStr(p.GithubURL),
ProdDeploymentId: safeStr(p.ProdDeploymentID),
ProdTtlSeconds: safeInt64(p.ProdTTLSeconds),
FrontendUrl: frontendURL,
CreatedOn: timestamppb.New(p.CreatedOn),
UpdatedOn: timestamppb.New(p.UpdatedOn),
Expand Down Expand Up @@ -809,6 +810,13 @@ func safeStr(s *string) string {
return *s
}

func safeInt64(s *int64) int64 {
if s == nil {
return 0
}
return *s
}

func valOrDefault[T any](ptr *T, def T) T {
if ptr != nil {
return *ptr
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/sudo/project/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func GetCmd(cfg *config.Config) *cobra.Command {
fmt.Printf("Prod OLAP DSN: %s\n", project.ProdOlapDsn)
fmt.Printf("Prod slots: %d\n", project.ProdSlots)
fmt.Printf("Prod deployment ID: %s\n", project.ProdDeploymentId)
fmt.Printf("Prod hibernation TTL: %s\n", time.Duration(project.ProdTtlSeconds)*time.Second)

return nil
},
Expand Down

0 comments on commit 8a70dfb

Please sign in to comment.