Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make events settings configurable #3214

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-events-config.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions nats/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ type Config struct {

// Nats is the nats config
type Nats struct {
Host string
Port int
Host string `ocisConfig:"host" env:"NATS_NATS_HOST"`
Port int `ocisConfig:"port" env:"NATS_NATS_PORT"`
}
4 changes: 2 additions & 2 deletions storage/pkg/command/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
"eventsmiddleware": map[string]interface{}{
"group": "sharing",
"type": "nats",
"address": "127.0.0.1:9233",
"clusterID": "test-cluster",
"address": cfg.Reva.Sharing.Events.Address,
"clusterID": cfg.Reva.Sharing.Events.ClusterID,
},
},
},
Expand Down
14 changes: 14 additions & 0 deletions storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ type Sharing struct {
PublicEnableExpiredSharesCleanup bool `ocisConfig:"public_enable_expired_shares_cleanup"`
PublicJanitorRunInterval int `ocisConfig:"public_janitor_run_interval"`
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.
Expand Down Expand Up @@ -1223,6 +1229,14 @@ func structMappings(cfg *Config) []shared.EnvBinding {
EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"},
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
{
Expand Down
4 changes: 4 additions & 0 deletions storage/pkg/config/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ func DefaultConfig() *Config {
PublicEnableExpiredSharesCleanup: true,
PublicJanitorRunInterval: 60,
UserStorageMountID: "",
Events: Events{
Address: "127.0.0.1:9233",
ClusterID: "test-cluster",
},
},
StorageShares: StoragePort{
Port: Port{
Expand Down