mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-24 04:58:31 -05:00
Move reva transfer secret to shared.Commons
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -42,6 +42,6 @@ type Thumbnail struct {
|
||||
CS3AllowInsecure bool `yaml:"cs3_allow_insecure,omitempty" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE"`
|
||||
RevaGateway string `yaml:"reva_gateway,omitempty" env:"REVA_GATEWAY"` //TODO: use REVA config
|
||||
FontMapFile string `yaml:"font_map_file,omitempty" env:"THUMBNAILS_TXT_FONTMAP_FILE"`
|
||||
TransferTokenSecret string `yaml:"transfer_token,omitempty" env:"THUMBNAILS_TRANSFER_TOKEN"`
|
||||
TransferSecret string `yaml:"transfer_secret,omitempty" env:"THUMBNAILS_TRANSFER_TOKEN"`
|
||||
DataEndpoint string `yaml:"data_endpoint,omitempty" env:"THUMBNAILS_DATA_ENDPOINT"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package defaults
|
||||
|
||||
import (
|
||||
"log"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis/extensions/thumbnails/pkg/config"
|
||||
@@ -44,7 +45,6 @@ func DefaultConfig() *config.Config {
|
||||
WebdavAllowInsecure: false,
|
||||
RevaGateway: "127.0.0.1:9142",
|
||||
CS3AllowInsecure: false,
|
||||
TransferTokenSecret: "changemeplease",
|
||||
DataEndpoint: "http://127.0.0.1:9186/thumbnails/data",
|
||||
},
|
||||
}
|
||||
@@ -73,6 +73,12 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.Tracing == nil {
|
||||
cfg.Tracing = &config.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.Thumbnail.TransferSecret == "" && cfg.Commons != nil && cfg.Commons.TransferSecret != "" {
|
||||
cfg.Thumbnail.TransferSecret = cfg.Commons.TransferSecret
|
||||
} else {
|
||||
log.Fatalf("reva transfer secret is not set up properly, bailing out (%s)", cfg.Service.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewService(opts ...Option) decorators.DecoratedService {
|
||||
TxtFontFileMap: options.Config.Thumbnail.FontMapFile,
|
||||
},
|
||||
dataEndpoint: options.Config.Thumbnail.DataEndpoint,
|
||||
transferTokenSecret: options.Config.Thumbnail.TransferTokenSecret,
|
||||
transferTokenSecret: options.Config.Thumbnail.TransferSecret,
|
||||
}
|
||||
|
||||
return svc
|
||||
|
||||
@@ -102,7 +102,7 @@ func (s Thumbnails) TransferTokenValidator(next http.Handler) http.Handler {
|
||||
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
|
||||
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
|
||||
}
|
||||
return []byte(s.config.Thumbnail.TransferTokenSecret), nil
|
||||
return []byte(s.config.Thumbnail.TransferSecret), nil
|
||||
})
|
||||
if err != nil {
|
||||
s.logger.Error().
|
||||
|
||||
Reference in New Issue
Block a user