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

Function readFromFile

env/edit.go:130–148  ·  view source on GitHub ↗
(ctx context.Context, filePath string)

Source from the content-addressed store, hash-verified

128}
129
130func readFromFile(ctx context.Context, filePath string) (map[string]string, error) {
131 if filePath == "" {
132 return map[string]string{}, nil
133 }
134
135 if filePath == "-" {
136 variables, err := godotenv.Parse(os.Stdin)
137 if err != nil {
138 return nil, errors.Wrapf(ctx, err, "parse .env from stdin")
139 }
140 return variables, nil
141 }
142
143 variables, err := godotenv.Read(filePath)
144 if err != nil {
145 return nil, errors.Wrapf(ctx, err, "invalid .env file")
146 }
147 return variables, nil
148}

Callers 1

AddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected