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

Function Get

env/display.go:27–43  ·  view source on GitHub ↗
(ctx context.Context, appName, variableName string)

Source from the content-addressed store, hash-verified

25}
26
27func Get(ctx context.Context, appName, variableName string) (string, error) {
28 c, err := config.ScalingoClient(ctx)
29 if err != nil {
30 return "", errors.Wrapf(ctx, err, "fail to get Scalingo client to get an environment variable")
31 }
32 vars, err := c.VariablesListWithoutAlias(ctx, appName)
33 if err != nil {
34 return "", errors.Wrapf(ctx, err, "fail to list the environment variables")
35 }
36
37 for _, v := range vars {
38 if v.Name == variableName {
39 return v.Value, nil
40 }
41 }
42 return "", errors.New(ctx, "environment variable not found")
43}

Callers 1

env.goFile · 0.92

Calls 1

ScalingoClientFunction · 0.92

Tested by

no test coverage detected