Skip to content

Commit a2b6b9f

Browse files
authored
Allow src & dst connection strings to be in config.yml. (#142)
This fixes breakage introduced in commit 1f47e80.
1 parent 439fc9d commit a2b6b9f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

main/migration_verifier.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ func main() {
7676
Usage: "path to an optional YAML config file",
7777
}),
7878
altsrc.NewStringFlag(cli.StringFlag{
79-
Name: srcURI,
80-
Usage: "source connection string",
81-
Required: true,
79+
Name: srcURI,
80+
Usage: "source connection string",
8281
}),
8382
altsrc.NewStringFlag(cli.StringFlag{
84-
Name: dstURI,
85-
Usage: "destination connection string",
86-
Required: true,
83+
Name: dstURI,
84+
Usage: "destination connection string",
8785
}),
8886
altsrc.NewStringFlag(cli.StringFlag{
8987
Name: metaURI,
@@ -256,6 +254,17 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err
256254
verifierSettings.ReadConcernSetting = verifier.ReadConcernIgnore
257255
}
258256

257+
missingStringArgs := lo.Filter(
258+
mslices.Of(srcURI, dstURI),
259+
func(setting string, _ int) bool {
260+
return cCtx.String(setting) == ""
261+
},
262+
)
263+
264+
if len(missingStringArgs) > 0 {
265+
return nil, fmt.Errorf("missing required parameters: %#q", missingStringArgs)
266+
}
267+
259268
logPath := cCtx.String(logPath)
260269

261270
v := verifier.NewVerifier(verifierSettings, logPath)

0 commit comments

Comments
 (0)