From ad8eda9e9773b011abfa08f013b96a8d87a08d16 Mon Sep 17 00:00:00 2001 From: Joao Zanutto Date: Sun, 14 Apr 2024 15:46:23 -0700 Subject: [PATCH 1/3] add dbname to storage path --- cmd/greenmask/cmd/dump/dump.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/greenmask/cmd/dump/dump.go b/cmd/greenmask/cmd/dump/dump.go index 9208ee22..00ee1082 100644 --- a/cmd/greenmask/cmd/dump/dump.go +++ b/cmd/greenmask/cmd/dump/dump.go @@ -46,6 +46,7 @@ var ( if err != nil { log.Fatal().Err(err).Msg("fatal") } + st = st.SubStorage(Config.Dump.PgDumpOptions.DbName,true) st = st.SubStorage(strconv.FormatInt(time.Now().UnixMilli(), 10), true) if Config.Common.TempDirectory == "" { From 57e451ecc5cb4f41a8ebb33aab258fa3966fc977 Mon Sep 17 00:00:00 2001 From: Joao Zanutto Date: Tue, 16 Apr 2024 11:29:02 -0700 Subject: [PATCH 2/3] substitue second call to substorage with fmt.sprintf --- cmd/greenmask/cmd/dump/dump.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/greenmask/cmd/dump/dump.go b/cmd/greenmask/cmd/dump/dump.go index 00ee1082..067443d2 100644 --- a/cmd/greenmask/cmd/dump/dump.go +++ b/cmd/greenmask/cmd/dump/dump.go @@ -46,8 +46,7 @@ var ( if err != nil { log.Fatal().Err(err).Msg("fatal") } - st = st.SubStorage(Config.Dump.PgDumpOptions.DbName,true) - st = st.SubStorage(strconv.FormatInt(time.Now().UnixMilli(), 10), true) + st = st.SubStorage(fmt.Sprintf("%s/%s", Config.Dump.PgDumpOptions.DbName, strconv.FormatInt(time.Now().UnixMilli(), 10)), true) if Config.Common.TempDirectory == "" { log.Fatal().Msg("common.tmp_dir cannot be empty") From 9e8b2ca477360fb261d16049e3108aa917913b1f Mon Sep 17 00:00:00 2001 From: Joao Zanutto Date: Tue, 16 Apr 2024 11:32:45 -0700 Subject: [PATCH 3/3] add dbname prefix to restore command --- cmd/greenmask/cmd/restore/restore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/greenmask/cmd/restore/restore.go b/cmd/greenmask/cmd/restore/restore.go index 84f0135d..01b7f3c4 100644 --- a/cmd/greenmask/cmd/restore/restore.go +++ b/cmd/greenmask/cmd/restore/restore.go @@ -54,7 +54,7 @@ var ( log.Fatal().Err(err).Msg("") } - st = st.SubStorage(dumpId, true) + st = st.SubStorage(fmt.Sprintf("%s/%s", Config.Restore.PgRestoreOptions.DbName, dumpId, true) restore := cmdInternals.NewRestore( Config.Common.PgBinPath, st, &Config.Restore.PgRestoreOptions, Config.Restore.Scripts,