Skip to content

Commit 5d7b0c5

Browse files
committed
fix(Tool sync cosmos from json): Use db/conn env vars
1 parent c6c18d3 commit 5d7b0c5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/Propulsion.Tool/Sync.fs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ and [<NoEquality; NoComparison; RequireSubcommand>] CosmosParameters =
117117
| [<CliPrefix(CliPrefix.None); Last>] From of ParseResults<SourceParameters>
118118
interface IArgParserTemplate with
119119
member a.Usage = a |> function
120-
| Connection _ -> "specify a connection string for the destination Cosmos account. Default (if Cosmos): Same as Source"
121-
| Database _ -> "specify a database name for store. Default (if Cosmos): Same as Source"
120+
| Connection _ -> $"""specify a connection string for the destination Cosmos account.
121+
Default (From Cosmos): Same as Source.
122+
Default (From Json): optional if environment variable {Args.Configuration.Cosmos.CONNECTION} specified"""
123+
| Database _ -> $"""specify a database name for store.
124+
Default (From Cosmos): Same as Source.
125+
Default (From Json): optional if environment variable {Args.Configuration.Cosmos.DATABASE} specified"""
122126
| Container _ -> "specify a container name for store."
123127
| LeaseContainerId _ -> "store leases in Sync target DB (default: use `-aux` adjacent to the Source Container). Enables the Source to be read via a ReadOnly connection string."
124128
| Timeout _ -> "specify operation timeout in seconds. Default: 5."
@@ -130,7 +134,7 @@ and CosmosArguments(c: Args.Configuration, p: ParseResults<CosmosParameters>) =
130134
let source = SourceArguments(c, p.GetResult CosmosParameters.From)
131135
let connection = match source.Store with
132136
| Cosmos c -> p.GetResult(Connection, fun () -> c.Connection)
133-
| Json _ -> p.GetResult Connection
137+
| Json _ -> p.GetResult(Connection, fun () -> c.CosmosConnection)
134138
| x -> p.Raise $"unexpected subcommand %A{x}"
135139
let connector =
136140
let timeout = p.GetResult(Timeout, 5) |> TimeSpan.seconds
@@ -139,7 +143,7 @@ and CosmosArguments(c: Args.Configuration, p: ParseResults<CosmosParameters>) =
139143
Equinox.CosmosStore.CosmosStoreConnector(Equinox.CosmosStore.Discovery.ConnectionString connection, timeout, retries, maxRetryWaitTime)
140144
let database = match source.Store with
141145
| Cosmos c -> p.GetResult(Database, fun () -> c.Database)
142-
| Json _ -> p.GetResult Database
146+
| Json _ -> p.GetResult(Database, fun () -> c.CosmosDatabase)
143147
| x -> p.Raise $"unexpected subcommand %A{x}"
144148
let container = p.GetResult Container
145149
member val Source = source

0 commit comments

Comments
 (0)