MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / processCAFlag

Function processCAFlag

app/cli/cmd/root.go:542–560  ·  view source on GitHub ↗

processCAFlag reads CA file content and stores it as PEM if value is a file path

(opt *confOpt)

Source from the content-addressed store, hash-verified

540
541// processCAFlag reads CA file content and stores it as PEM if value is a file path
542func processCAFlag(opt *confOpt) error {
543 value := viper.GetString(opt.viperKey)
544 if value == "" {
545 return nil
546 }
547
548 // If it's a file path, read and store PEM content directly
549 if _, err := os.Stat(value); err == nil {
550 content, err := os.ReadFile(value)
551 if err != nil {
552 return fmt.Errorf("failed to read CA file %s: %w", value, err)
553 }
554
555 // Store PEM content directly
556 viper.Set(opt.viperKey, string(content))
557 }
558
559 return nil
560}

Callers 1

newConfigSaveCmdFunction · 0.85

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected