(ctx context.Context, appName string)
| 15 | ) |
| 16 | |
| 17 | func Info(ctx context.Context, appName string) error { |
| 18 | c, err := config.ScalingoClient(ctx) |
| 19 | if err != nil { |
| 20 | return errors.Wrapf(ctx, err, "get Scalingo client") |
| 21 | } |
| 22 | |
| 23 | app, err := c.AppsShow(ctx, appName) |
| 24 | if err != nil { |
| 25 | return errors.Wrapf(ctx, err, "get the application information from the API") |
| 26 | } |
| 27 | |
| 28 | stackName, err := getStackName(ctx, c, app.StackID) |
| 29 | if err != nil { |
| 30 | debug.Println("Failed to get the stack name from its ID:", err) |
| 31 | stackName = app.StackID |
| 32 | } |
| 33 | |
| 34 | t := tablewriter.NewWriter(os.Stdout) |
| 35 | t.Header([]string{"Settings", "Value"}) |
| 36 | _ = t.Append([]string{"Project", app.ProjectSlug()}) |
| 37 | _ = t.Append([]string{"Force HTTPS", strconv.FormatBool(app.ForceHTTPS)}) |
| 38 | _ = t.Append([]string{"Sticky Session", strconv.FormatBool(app.StickySession)}) |
| 39 | _ = t.Append([]string{"Stack", stackName}) |
| 40 | _ = t.Append([]string{"Status", fmt.Sprintf("%v", app.Status)}) |
| 41 | _ = t.Append([]string{"HDS", strconv.FormatBool(app.HDSResource)}) |
| 42 | _ = t.Render() |
| 43 | |
| 44 | return nil |
| 45 | } |
| 46 | |
| 47 | func getStackName(ctx context.Context, c *scalingo.Client, stackID string) (string, error) { |
| 48 | stacks, err := c.StacksList(ctx) |
no test coverage detected