in pkg/berglas/reference.go [235:253]
func refExtractFilepath(object, s string) (string, error) {
switch s {
case "tmpfile", "tempfile":
suffix := filepath.Ext(object)
pattern := fmt.Sprintf("berglas-*%s", suffix)
// create a tempfile for the path
f, err := os.CreateTemp("", pattern)
if err != nil {
return "", fmt.Errorf("failed to create tempfile for secret: %w", err)
}
if err := f.Close(); err != nil {
return "", fmt.Errorf("failed to close tempfile for secret: %w", err)
}
return f.Name(), nil
default:
// assume file path - this works if s is "" too
return s, nil
}
}