From 0b56e026aa1106e5d7d4585e67f8947a79c099f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 18 May 2022 09:03:28 +0200 Subject: [PATCH] Configure the nats service for the system storage extension --- extensions/storage-system/pkg/config/config.go | 10 ++++++++-- extensions/storage-users/pkg/revaconfig/config.go | 14 ++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/extensions/storage-system/pkg/config/config.go b/extensions/storage-system/pkg/config/config.go index 141319a2440..4abfdd962bf 100644 --- a/extensions/storage-system/pkg/config/config.go +++ b/extensions/storage-system/pkg/config/config.go @@ -13,8 +13,9 @@ type Config struct { Log *Log `yaml:"log"` Debug Debug `yaml:"debug"` - GRPC GRPCConfig `yaml:"grpc"` - HTTP HTTPConfig `yaml:"http"` + GRPC GRPCConfig `yaml:"grpc"` + HTTP HTTPConfig `yaml:"http"` + Events Events `yaml:"events"` TokenManager *TokenManager `yaml:"token_manager"` Reva *Reva `yaml:"reva"` @@ -77,3 +78,8 @@ type OCISDriver struct { // Root is the absolute path to the location of the data Root string `yaml:"root" env:"STORAGE_SYSTEM_OCIS_ROOT"` } + +type Events struct { + Addr string `yaml:"endpoint" env:"STORAGE_SYSTEM_EVENTS_ENDPOINT" desc:"the address of the streaming service"` + ClusterID string `yaml:"cluster" env:"STORAGE_SYSTEM_EVENTS_CLUSTER" desc:"the clusterID of the streaming service. Mandatory when using nats"` +} diff --git a/extensions/storage-users/pkg/revaconfig/config.go b/extensions/storage-users/pkg/revaconfig/config.go index cf2d64ac1ff..9dd8454f755 100644 --- a/extensions/storage-users/pkg/revaconfig/config.go +++ b/extensions/storage-users/pkg/revaconfig/config.go @@ -47,12 +47,14 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { // TODO build services dynamically "services": map[string]interface{}{ "dataprovider": map[string]interface{}{ - "prefix": cfg.HTTP.Prefix, - "driver": cfg.Driver, - "drivers": UserDrivers(cfg), - "timeout": 86400, - "insecure": cfg.DataProviderInsecure, - "disable_tus": false, + "prefix": cfg.HTTP.Prefix, + "driver": cfg.Driver, + "drivers": UserDrivers(cfg), + "timeout": 86400, + "insecure": cfg.DataProviderInsecure, + "disable_tus": false, + "nats_address": cfg.Events.Addr, + "nats_clusterID": cfg.Events.ClusterID, }, }, },