Revert backwards incompatible reva config changes
The commit of unifying the Reva Client config introduced some backwards incompatible changes to the config structures and yaml config tags. For the "thumbnails", "webdav" and "notifications" service. This reverts the changes on the service and introduces TLS options in a backwards compatible manner.
This commit is contained in:
committed by
Ralf Haferkamp
parent
8cead4557f
commit
fbb3382a42
@@ -27,7 +27,15 @@ type Channel interface {
|
||||
|
||||
// NewMailChannel instantiates a new mail communication channel.
|
||||
func NewMailChannel(cfg config.Config, logger log.Logger) (Channel, error) {
|
||||
gc, err := pool.GetGatewayServiceClient(cfg.Notifications.Reva.Address, cfg.Notifications.Reva.GetRevaOptions()...)
|
||||
tm, err := pool.StringToTLSMode(cfg.Notifications.RevaGatewayTLSMode)
|
||||
if err != nil {
|
||||
logger.Error().Err(err).Msg("could not get gateway client tls mode")
|
||||
return nil, err
|
||||
}
|
||||
gc, err := pool.GetGatewayServiceClient(cfg.Notifications.RevaGateway,
|
||||
pool.WithTLSCACert(cfg.Notifications.RevaGatewayTLSCACert),
|
||||
pool.WithTLSMode(tm),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error().Err(err).Msg("could not get gateway client")
|
||||
return nil, err
|
||||
|
||||
@@ -77,12 +77,17 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tm, err := pool.StringToTLSMode(cfg.Notifications.RevaGatewayTLSMode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gwclient, err := pool.GetGatewayServiceClient(
|
||||
cfg.Notifications.Reva.Address,
|
||||
cfg.Notifications.Reva.GetRevaOptions()...,
|
||||
cfg.Notifications.RevaGateway,
|
||||
pool.WithTLSCACert(cfg.Notifications.RevaGatewayTLSCACert),
|
||||
pool.WithTLSMode(tm),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatal().Err(err).Str("addr", cfg.Notifications.Reva.Address).Msg("could not get reva client")
|
||||
logger.Fatal().Err(err).Str("addr", cfg.Notifications.RevaGateway).Msg("could not get reva client")
|
||||
}
|
||||
|
||||
svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.Commons.OcisURL)
|
||||
|
||||
@@ -22,11 +22,13 @@ type Config struct {
|
||||
|
||||
// Notifications defines the config options for the notifications service.
|
||||
type Notifications struct {
|
||||
SMTP SMTP `yaml:"SMTP"`
|
||||
Events Events `yaml:"events"`
|
||||
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;NOTIFICATIONS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."`
|
||||
Reva shared.Reva `yaml:"reva"`
|
||||
EmailTemplatePath string `yaml:"email_template_path" env:"OCIS_EMAIL_TEMPLATE_PATH;NOTIFICATIONS_EMAIL_TEMPLATE_PATH" desc:"Path to Email notification templates overriding embedded ones."`
|
||||
SMTP SMTP `yaml:"SMTP"`
|
||||
Events Events `yaml:"events"`
|
||||
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;NOTIFICATIONS_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary to access resources from other services."`
|
||||
EmailTemplatePath string `yaml:"email_template_path" env:"OCIS_EMAIL_TEMPLATE_PATH;NOTIFICATIONS_EMAIL_TEMPLATE_PATH" desc:"Path to Email notification templates overriding embedded ones."`
|
||||
RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY" desc:"CS3 gateway used to look up user metadata"`
|
||||
RevaGatewayTLSMode string `yaml:"reva_gateway_tls_mode" env:"REVA_GATEWAY_TLS_MODE"`
|
||||
RevaGatewayTLSCACert string `yaml:"reva_gateway_tls_cacert" env:"REVA_GATEWAY_TLS_CACERT"`
|
||||
}
|
||||
|
||||
// SMTP combines the smtp configuration options.
|
||||
|
||||
@@ -37,7 +37,9 @@ func DefaultConfig() *config.Config {
|
||||
ConsumerGroup: "notifications",
|
||||
EnableTLS: false,
|
||||
},
|
||||
Reva: *shared.DefaultRevaConfig(),
|
||||
RevaGateway: shared.DefaultRevaConfig().Address,
|
||||
RevaGatewayTLSMode: shared.DefaultRevaConfig().TLSMode,
|
||||
RevaGatewayTLSCACert: shared.DefaultRevaConfig().TLSCACert,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user