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

Function writeAuthFile

config/auth.go:281–293  ·  view source on GitHub ↗
(ctx context.Context, authConfig *auth.ConfigData)

Source from the content-addressed store, hash-verified

279}
280
281func writeAuthFile(ctx context.Context, authConfig *auth.ConfigData) error {
282 file, err := os.OpenFile(C.AuthFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0700)
283 if err != nil {
284 return errors.Wrapf(ctx, err, "open authentication file for writing")
285 }
286 defer file.Close()
287
288 enc := json.NewEncoder(file)
289 if err := enc.Encode(authConfig); err != nil {
290 return errors.Wrapf(ctx, err, "encode authentication file")
291 }
292 return nil
293}
294
295func existingAuth(ctx context.Context) (*auth.ConfigData, error) {
296 authConfig := auth.NewConfigData()

Callers 3

StoreAuthMethod · 0.85
LoadAuthMethod · 0.85
RemoveAuthMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected