From 81b5615b6b08b14f6645937dbc41f70bffe8a7f9 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Tue, 3 Nov 2020 15:57:54 +0100 Subject: [PATCH] the address of a variable cannot be nil... --- accounts/pkg/service/v0/service.go | 54 ++++++++++++++++-------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/accounts/pkg/service/v0/service.go b/accounts/pkg/service/v0/service.go index 829689f2af..45d4db2379 100644 --- a/accounts/pkg/service/v0/service.go +++ b/accounts/pkg/service/v0/service.go @@ -103,38 +103,40 @@ func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) { } }(cfg) - if &cfg.Repo.Disk != nil { - c.Repo = idxcfg.Repo{ - Disk: idxcfg.Disk{ - Path: cfg.Repo.Disk.Path, - }, + if (config.Repo{}) != cfg.Repo { + if (config.Disk{}) != cfg.Repo.Disk { + c.Repo = idxcfg.Repo{ + Disk: idxcfg.Disk{ + Path: cfg.Repo.Disk.Path, + }, + } } - } - if &cfg.Repo.CS3 != nil { - c.Repo = idxcfg.Repo{ - CS3: idxcfg.CS3{ - ProviderAddr: cfg.Repo.CS3.ProviderAddr, - DataURL: cfg.Repo.CS3.DataURL, - DataPrefix: cfg.Repo.CS3.DataPrefix, - JWTSecret: cfg.Repo.CS3.JWTSecret, - }, + if (config.CS3{}) != cfg.Repo.CS3 { + c.Repo = idxcfg.Repo{ + CS3: idxcfg.CS3{ + ProviderAddr: cfg.Repo.CS3.ProviderAddr, + DataURL: cfg.Repo.CS3.DataURL, + DataPrefix: cfg.Repo.CS3.DataPrefix, + JWTSecret: cfg.Repo.CS3.JWTSecret, + }, + } } - } - if &cfg.Index != nil { - c.Index = idxcfg.Index{ - UID: idxcfg.Bound{ - Lower: cfg.Index.UID.Lower, - }, - GID: idxcfg.Bound{ - Lower: cfg.Index.GID.Lower, - }, + if (config.Index{}) != cfg.Index { + c.Index = idxcfg.Index{ + UID: idxcfg.Bound{ + Lower: cfg.Index.UID.Lower, + }, + GID: idxcfg.Bound{ + Lower: cfg.Index.GID.Lower, + }, + } } - } - if &cfg.ServiceUser != nil { - c.ServiceUser = cfg.ServiceUser + if (config.ServiceUser{}) != cfg.ServiceUser { + c.ServiceUser = cfg.ServiceUser + } } return c, nil