cs3org / reva

WebDAV/gRPC/HTTP high performance server to link high level clients to storage backends
https://reva.link
Apache License 2.0
167 stars 113 forks source link

Add layout configuration for path wrapper #473

Open labkode opened 4 years ago

labkode commented 4 years ago

In pkg/storage/pw/context/context.go we can add a new config like:

type config struct { 
       Layout string `mapstructure:"layout"`
        Prefix string `mapstructure:"prefix"`
}

and then on the Wrap and Unwrap methods there is some string substitution.

For example:

[x.y.z]
layout = "{{.Provider}}/{{.Username}}"

And the we use Go templates to fill those variables:

u := context.GetUser(ctx)
t := template.Must(template.New("").Parse(conf.Layout))
madsi1m commented 4 years ago

How about https://github.com/cs3org/reva/pull/476 ?