diff --git a/fs/open_options.go b/fs/open_options.go index 26d6d7053..cbcd98cb7 100644 --- a/fs/open_options.go +++ b/fs/open_options.go @@ -3,6 +3,7 @@ package fs import ( + "context" "errors" "fmt" "net/http" @@ -276,6 +277,15 @@ func (o MetadataOption) Mandatory() bool { return false } +// MetadataAsOpenOptions fetch any metadata to set as open options +func MetadataAsOpenOptions(ctx context.Context) (options []OpenOption) { + ci := GetConfig(ctx) + if ci.MetadataSet != nil { + options = append(options, MetadataOption(ci.MetadataSet)) + } + return options +} + // ChunkOption defines an Option which returns a preferred chunk size type ChunkOption struct { ChunkSize int64