make events settings configurable

This commit is contained in:
Willy Kloucek
2022-02-22 13:55:32 +01:00
parent 949308bd61
commit 6cbdbd87f2
5 changed files with 27 additions and 4 deletions
@@ -0,0 +1,5 @@
Bugfix: Make events settings configurable
We've fixed the hardcoded events settings to be configurable.
https://github.com/owncloud/ocis/pull/3214
+2 -2
View File
@@ -22,6 +22,6 @@ type Config struct {
// Nats is the nats config // Nats is the nats config
type Nats struct { type Nats struct {
Host string Host string `ocisConfig:"host" env:"NATS_NATS_HOST"`
Port int Port int `ocisConfig:"port" env:"NATS_NATS_PORT"`
} }
+2 -2
View File
@@ -179,8 +179,8 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
"eventsmiddleware": map[string]interface{}{ "eventsmiddleware": map[string]interface{}{
"group": "sharing", "group": "sharing",
"type": "nats", "type": "nats",
"address": "127.0.0.1:9233", "address": cfg.Reva.Sharing.Events.Address,
"clusterID": "test-cluster", "clusterID": cfg.Reva.Sharing.Events.ClusterID,
}, },
}, },
}, },
+14
View File
@@ -89,6 +89,12 @@ type Sharing struct {
PublicEnableExpiredSharesCleanup bool `ocisConfig:"public_enable_expired_shares_cleanup"` PublicEnableExpiredSharesCleanup bool `ocisConfig:"public_enable_expired_shares_cleanup"`
PublicJanitorRunInterval int `ocisConfig:"public_janitor_run_interval"` PublicJanitorRunInterval int `ocisConfig:"public_janitor_run_interval"`
UserStorageMountID string `ocisConfig:"user_storage_mount_id"` UserStorageMountID string `ocisConfig:"user_storage_mount_id"`
Events Events `ocisConfig:"events"`
}
type Events struct {
Address string `ocisConfig:"address"`
ClusterID string `ocisConfig:"cluster_id"`
} }
// Port defines the available port configuration. // Port defines the available port configuration.
@@ -1223,6 +1229,14 @@ func structMappings(cfg *Config) []shared.EnvBinding {
EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"}, EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"},
Destination: &cfg.Reva.Sharing.UserSQLName, Destination: &cfg.Reva.Sharing.UserSQLName,
}, },
{
EnvVars: []string{"STORAGE_SHARING_EVENTS_ADDRESS"},
Destination: &cfg.Reva.Sharing.Events.Address,
},
{
EnvVars: []string{"STORAGE_SHARING_EVENTS_CLUSTER_ID"},
Destination: &cfg.Reva.Sharing.Events.ClusterID,
},
// storage metadata // storage metadata
{ {
+4
View File
@@ -348,6 +348,10 @@ func DefaultConfig() *Config {
PublicEnableExpiredSharesCleanup: true, PublicEnableExpiredSharesCleanup: true,
PublicJanitorRunInterval: 60, PublicJanitorRunInterval: 60,
UserStorageMountID: "", UserStorageMountID: "",
Events: Events{
Address: "127.0.0.1:9233",
ClusterID: "test-cluster",
},
}, },
StorageShares: StoragePort{ StorageShares: StoragePort{
Port: Port{ Port: Port{