Merge pull request #1956 from owncloud/fix-1955

This commit is contained in:
Alex Unger
2021-04-22 17:10:53 +02:00
committed by GitHub
3 changed files with 19 additions and 7 deletions
@@ -0,0 +1,5 @@
Bugfix: Fix STORAGE_METADATA_ROOT default value override
The way the value was being set ensured that it was NOT being overridden where it should have been. This patch ensures the correct loading order of values.
https://github.com/owncloud/ocis/pull/1956
+7
View File
@@ -67,6 +67,13 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
cfg.Reva.Storages.OwnCloud.EnableHome = false
cfg.Reva.Storages.S3.EnableHome = false
// We need this hack because the metadata storage can define STORAGE_METADATA_ROOT which has the same destination as
// STORAGE_DRIVER_OCIS_ROOT. When both variables are set one storage will always be out of sync. Ensure the
// metadata storage root is never overridden. This is the kind of stateful code that make you want to cry blood.
if os.Getenv("STORAGE_METADATA_ROOT") != "" && os.Getenv("STORAGE_DRIVER_OCIS_ROOT") != "" {
cfg.Reva.Storages.Common.Root = os.Getenv("STORAGE_METADATA_ROOT")
}
rcfg := storageMetadataFromStruct(c, cfg)
gr.Add(func() error {
+7 -7
View File
@@ -89,13 +89,6 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
},
}
f = append(f, TracingWithConfig(cfg)...)
f = append(f, DebugWithConfig(cfg)...)
f = append(f, SecretWithConfig(cfg)...)
f = append(f, DriverEOSWithConfig(cfg)...)
f = append(f, DriverLocalWithConfig(cfg)...)
f = append(f, DriverOwnCloudWithConfig(cfg)...)
f = append(f, DriverOCISWithConfig(cfg)...)
f = append(f,
&cli.StringFlag{
Name: "storage-root",
@@ -105,6 +98,13 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Storages.Common.Root,
},
)
f = append(f, TracingWithConfig(cfg)...)
f = append(f, DebugWithConfig(cfg)...)
f = append(f, SecretWithConfig(cfg)...)
f = append(f, DriverEOSWithConfig(cfg)...)
f = append(f, DriverLocalWithConfig(cfg)...)
f = append(f, DriverOwnCloudWithConfig(cfg)...)
f = append(f, DriverOCISWithConfig(cfg)...)
return f
}