Skip to content

Commit 9db5ad4

Browse files
committed
fix cli params
1 parent 6bdbbf9 commit 9db5ad4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
28 KB
Binary file not shown.

FSharp/FSharpRepoDB/FSharpRepoDB/Program.fs

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,31 @@ open RepoDb
66
open RepoDb.Extensions
77
open FSharpRepoDB.Types
88

9-
let url (argv: string array) =
9+
let getUrl (argv: string array) =
1010
let getFromEnv =
1111
System.Environment.GetEnvironmentVariable("MSSQL_DB_URL")
1212
|> Option.ofObj
1313

1414
let fromArgsOrEnv =
1515
argv
16-
|> Array.tryFind(fun arg -> arg.Contains "--dburl=")
17-
|> Option.map (fun f -> f.Split('=') |> Seq.tryLast)
16+
|> Array.tryFind(fun arg -> arg.Contains "--dburl~")
17+
|> Option.map (fun f -> f.Split('~') |> Seq.tryLast)
1818
|> Option.flatten
1919
|> Option.orElse getFromEnv
2020

21-
fromArgsOrEnv |> Option.defaultValue "Server=127.0.0.1;Database=TestDB;User Id=sa;Password=Password1!;"
21+
fromArgsOrEnv |> Option.defaultValue "Server=.;Database=TestDB;Integrated Security=SSPI;"
2222

2323
[<EntryPoint>]
2424
let main argv =
25+
// you can set "MSSQL_DB_URL" env variable or run the following command to use a Custom URL for testing purposes
26+
/// dotnet run -p FSharpRepoDB -- "--dburl~Server=127.0.0.1;Database=TestDB;User Id=sa;Password=Password1!;"
2527
2628
// Initialize the SQL Server
2729
SqlServerBootstrap.Initialize()
2830

2931
// Open the connection
30-
let connection = (new SqlConnection(url argv)).EnsureOpen()
32+
let url = getUrl argv
33+
let connection = (new SqlConnection(url)).EnsureOpen()
3134

3235
// Get the fields
3336
let personType = typedefof<Person>

0 commit comments

Comments
 (0)