MCPcopy Create free account
hub / github.com/Scalingo/cli / Info

Function Info

apps/info.go:17–45  ·  view source on GitHub ↗
(ctx context.Context, appName string)

Source from the content-addressed store, hash-verified

15)
16
17func 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
47func getStackName(ctx context.Context, c *scalingo.Client, stackID string) (string, error) {
48 stacks, err := c.StacksList(ctx)

Callers 1

apps.goFile · 0.92

Calls 3

ScalingoClientFunction · 0.92
getStackNameFunction · 0.85
RenderMethod · 0.65

Tested by

no test coverage detected