mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
SqlConnectionStringBuilder to make connection string
This commit is contained in:
parent
eef67f3043
commit
9b3e2dcd58
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@ -92,9 +93,19 @@ namespace Setup
|
||||
|
||||
public static string MakeSqlConnectionString(string server, string database, string username, string password)
|
||||
{
|
||||
return $"Server=tcp:{server},1433;Initial Catalog={database};Persist Security Info=False;User ID={username};" +
|
||||
$"Password={password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;" +
|
||||
"Connection Timeout=30;";
|
||||
var builder = new SqlConnectionStringBuilder
|
||||
{
|
||||
DataSource = $"tcp:{server},1433",
|
||||
InitialCatalog = database,
|
||||
UserID = username,
|
||||
Password = password,
|
||||
MultipleActiveResultSets = false,
|
||||
Encrypt = true,
|
||||
ConnectTimeout = 30,
|
||||
TrustServerCertificate = true,
|
||||
PersistSecurityInfo = false
|
||||
};
|
||||
return builder.ConnectionString;
|
||||
}
|
||||
|
||||
public static string GetDatabasePasswordFronEnvFile()
|
||||
|
Loading…
Reference in New Issue
Block a user