Get the environment variable properly

This commit is contained in:
Joseph Ferano 2022-07-21 15:12:24 +07:00
parent b86adff83d
commit f921d7b123

View File

@ -12,10 +12,10 @@ open Giraffe
open dotenv.net open dotenv.net
open Npgsql.FSharp open Npgsql.FSharp
let prodEnv = DotEnv.Read(DotEnvOptions(envFilePaths = [ "../.prod.env"], overwriteExistingVars = false)) DotEnv.Load(DotEnvOptions(envFilePaths = [ "../.prod.env" ], overwriteExistingVars = false))
let ( _ , connStr ) = prodEnv.TryGetValue("DATABASE_URL") let connStr = Environment.GetEnvironmentVariable("DATABASE_URL")
let ( _ , apiKey ) = prodEnv.TryGetValue("API_KEY") let apiKey = Environment.GetEnvironmentVariable("API_KEY")
let validateApiKey (ctx : HttpContext) = let validateApiKey (ctx : HttpContext) =
match ctx.TryGetRequestHeader "X-API-Key" with match ctx.TryGetRequestHeader "X-API-Key" with