Skip to content

Commit 6aa060e

Browse files
committed
Add cosmos mode switch
1 parent d1d4d42 commit 6aa060e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tools/Propulsion.Tool/Propulsion.Tool.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
3232

3333
<!-- The tool should use a relatively fresh Cosmos lib; Equinox.CosmosStore has a conservative dependency-->
34-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.46.0" />
34+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.49.0" />
3535

3636
<PackageReference Include="Argu" Version="6.2.2" />
3737
<!-- Required or there'll be an exception at runtime re missing support DLLs when using RBAC -->

tools/Propulsion.Tool/Sync.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ and KafkaArguments(c: Args.Configuration, p: ParseResults<KafkaParameters>) =
106106
member val Topic = p.GetResult(Topic, fun () -> c.KafkaTopic)
107107
member val Source = SourceArguments(c, p.GetResult KafkaParameters.From)
108108
and [<NoEquality; NoComparison; RequireSubcommand>] CosmosParameters =
109+
| [<AltCommandLine "-m">] ConnectionMode of Microsoft.Azure.Cosmos.ConnectionMode
109110
| [<AltCommandLine "-s">] Connection of string
110111
| [<AltCommandLine "-d">] Database of string
111112
| [<AltCommandLine "-c"; Mandatory>] Container of string
@@ -117,6 +118,7 @@ and [<NoEquality; NoComparison; RequireSubcommand>] CosmosParameters =
117118
| [<CliPrefix(CliPrefix.None); Last>] From of ParseResults<SourceParameters>
118119
interface IArgParserTemplate with
119120
member a.Usage = a |> function
121+
| ConnectionMode _ -> "override the connection mode. Default: Direct."
120122
| Connection _ -> $"""specify a connection string for the destination Cosmos account.
121123
Default (From Cosmos): Same as Source.
122124
Default (From Json): optional if environment variable {Args.Configuration.Cosmos.CONNECTION} specified"""
@@ -138,8 +140,9 @@ and CosmosArguments(c: Args.Configuration, p: ParseResults<CosmosParameters>) =
138140
| x -> p.Raise $"unexpected subcommand %A{x}"
139141
let connector =
140142
let retries = p.GetResult(Retries, 2)
143+
let mode = p.TryGetResult ConnectionMode
141144
let maxRetryWaitTime = p.GetResult(RetriesWaitTime, 5) |> TimeSpan.seconds
142-
Equinox.CosmosStore.CosmosStoreConnector(Equinox.CosmosStore.Discovery.ConnectionString connection, retries, maxRetryWaitTime)
145+
Equinox.CosmosStore.CosmosStoreConnector(Equinox.CosmosStore.Discovery.ConnectionString connection, retries, maxRetryWaitTime, ?mode = mode)
143146
let database = match source.Store with
144147
| Cosmos c -> p.GetResult(Database, fun () -> c.Database)
145148
| Json _ -> p.GetResult(Database, fun () -> c.CosmosDatabase)

0 commit comments

Comments
 (0)