mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 12:19:37 -06:00
Merge pull request #2199 from ishank011/webdav-ns-config
Make webdav namespace configurable across services
This commit is contained in:
@@ -64,6 +64,7 @@ type Thumbnail struct {
|
||||
FileSystemStorage FileSystemStorage
|
||||
WebdavAllowInsecure bool
|
||||
RevaGateway string
|
||||
WebdavNamespace string
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
|
||||
@@ -162,6 +162,13 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
Usage: "--thumbnail-resolution 16x16 [--thumbnail-resolution 32x32]",
|
||||
EnvVars: []string{"THUMBNAILS_RESOLUTIONS"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "webdav-namespace",
|
||||
Value: flags.OverrideDefaultString(cfg.Thumbnail.WebdavNamespace, "/home"),
|
||||
Usage: "Namespace prefix for the webdav endpoint",
|
||||
EnvVars: []string{"STORAGE_WEBDAV_NAMESPACE"},
|
||||
Destination: &cfg.Thumbnail.WebdavNamespace,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
|
||||
logger.Fatal().Err(err).Msg("resolutions not configured correctly")
|
||||
}
|
||||
svc := Thumbnail{
|
||||
serviceID: options.Config.Server.Namespace + "." + options.Config.Server.Name,
|
||||
serviceID: options.Config.Server.Namespace + "." + options.Config.Server.Name,
|
||||
webdavNamespace: options.Config.Thumbnail.WebdavNamespace,
|
||||
manager: thumbnail.NewSimpleManager(
|
||||
resolutions,
|
||||
options.ThumbnailStorage,
|
||||
@@ -47,12 +48,13 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
|
||||
|
||||
// Thumbnail implements the GRPC handler.
|
||||
type Thumbnail struct {
|
||||
serviceID string
|
||||
manager thumbnail.Manager
|
||||
webdavSource imgsource.Source
|
||||
cs3Source imgsource.Source
|
||||
logger log.Logger
|
||||
cs3Client gateway.GatewayAPIClient
|
||||
serviceID string
|
||||
webdavNamespace string
|
||||
manager thumbnail.Manager
|
||||
webdavSource imgsource.Source
|
||||
cs3Source imgsource.Source
|
||||
logger log.Logger
|
||||
cs3Client gateway.GatewayAPIClient
|
||||
}
|
||||
|
||||
// GetThumbnail retrieves a thumbnail for an image
|
||||
@@ -161,7 +163,7 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *v0proto.GetThumb
|
||||
statPath = path.Join("/public", src.PublicLinkToken, req.Filepath)
|
||||
} else {
|
||||
auth = src.RevaAuthorization
|
||||
statPath = path.Join("/home", req.Filepath)
|
||||
statPath = path.Join(g.webdavNamespace, req.Filepath)
|
||||
}
|
||||
sRes, err := g.stat(statPath, auth)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user