Replace postgres uri

This commit is contained in:
Joseph Ferano 2022-02-24 18:25:01 +07:00
parent c6b5f94cff
commit 9f0de4e9a9
2 changed files with 8 additions and 1 deletions

View File

@ -11,7 +11,7 @@ DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.dev.env" ], overwriteEx
let getVar str = Environment.GetEnvironmentVariable(str)
let getId str = getVar str |> uint64
let pgDb = getVar "DATABASE_URL"
let pgDb = (getVar "DATABASE_URL").Replace("postgresql://", "postgres://")
let guildId = getId "DISCORD_GUILD"
let tokenPlayerInteractions = getVar "TOKEN_PLAYER_INTERACTIONS"

View File

@ -1,5 +1,6 @@
module Degenz.DbService
open System.Security.Cryptography.X509Certificates
open Degenz.Types
open System
@ -53,8 +54,14 @@ let tryFindPlayer connStr (discordId : uint64) =
async {
try
let! user =
// use cert = new X509Certificate2("~/Downloads/ca-certificate.crt")
// (Uri connStr)
// |> Sql.fromUriToConfig
// |> Sql.requireSslMode
// |> Sql.formatConnectionString
connStr
|> Sql.connect
// |> Sql.clientCertificate cert
|> Sql.parameters [ "did", Sql.string (string discordId) ]
|> Sql.query """
SELECT discord_id, display_name, gbt, strength, inventory FROM "user" WHERE discord_id = @did