Get rid of duplicated Reva config struct

Consolidate all services to use the Reva config struct for the shared package.
This works because all services (except 'notifications', 'thumbnails' and
'webdav') where using the same config keys and environment variables for
setting the reva gateway.
This commit is contained in:
Ralf Haferkamp
2022-10-25 11:50:08 +02:00
committed by Ralf Haferkamp
parent 0f507e7aab
commit e373e48383
71 changed files with 130 additions and 206 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ type Thumbnail struct {
FileSystemStorage FileSystemStorage `yaml:"filesystem_storage"`
WebdavAllowInsecure bool `yaml:"webdav_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the webdav source."`
CS3AllowInsecure bool `yaml:"cs3_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE" desc:"Ignore untrusted SSL certificates when connecting to the CS3 source."`
RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY" desc:"The CS3 gateway endpoint."` //TODO: use REVA config
Reva shared.Reva `yaml:"reva"`
FontMapFile string `yaml:"font_map_file" env:"THUMBNAILS_TXT_FONTMAP_FILE" desc:"The path to a font file for txt thumbnails."`
TransferSecret string `yaml:"transfer_secret" env:"THUMBNAILS_TRANSFER_TOKEN" desc:"The secret to sign JWT to download the actual thumbnail file."`
DataEndpoint string `yaml:"data_endpoint" env:"THUMBNAILS_DATA_ENDPOINT" desc:"The HTTP endpoint where the actual thumbnail file can be downloaded."`
@@ -5,6 +5,7 @@ import (
"strings"
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/config"
)
@@ -41,9 +42,11 @@ func DefaultConfig() *config.Config {
RootDirectory: path.Join(defaults.BaseDataPath(), "thumbnails"),
},
WebdavAllowInsecure: false,
RevaGateway: "127.0.0.1:9142",
CS3AllowInsecure: false,
DataEndpoint: "http://127.0.0.1:9186/thumbnails/data",
Reva: shared.Reva{
Address: "127.0.0.1:9142",
},
CS3AllowInsecure: false,
DataEndpoint: "http://127.0.0.1:9186/thumbnails/data",
},
}
}
@@ -26,7 +26,7 @@ func NewService(opts ...Option) grpc.Service {
grpc.Version(version.GetString()),
)
tconf := options.Config.Thumbnail
gc, err := pool.GetGatewayServiceClient(tconf.RevaGateway)
gc, err := pool.GetGatewayServiceClient(tconf.Reva.Address)
if err != nil {
options.Logger.Error().Err(err).Msg("could not get gateway client")
return grpc.Service{}