Skip to content

Commit

Permalink
chore: better initialization procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed Jul 3, 2024
1 parent 223d4f3 commit dbd92a9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/Informedica.GenForm.Lib/DoseRule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ cannot map {r}

let get_ dataUrl =
let prods = Product.get ()
let warnings = System.Collections.Generic.Dictionary<_, _>()

dataUrl
|> getData
Expand Down Expand Up @@ -659,9 +660,13 @@ cannot map {r}
|> Array.filter (fun p -> r.GPKs |> Array.exists (String.equalsCapInsens p.GPK))

if filtered |> Array.length = 0 then
ConsoleWriter.writeWarningMessage
$"no products for {gen} {rte}"
true false
let key = $"{gen} {rte}"
if warnings.ContainsKey(key) |> not then
warnings.Add(key, key)
ConsoleWriter.writeWarningMessage
$"no products for {key}"
true false

[|
{| r with
Products =
Expand Down
13 changes: 12 additions & 1 deletion src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ open Shared
open Shared.Api


printfn $"""
=== Initialized: ===
- Formulary {Formulary.empty |> Formulary.get |> ignore}
- Parenteralia {Parenteralia.empty |> Parenteralia.get |> ignore}
- Scenarios {ScenarioResult.empty |> ScenarioResult.get |> ignore}
"""


let tryGetEnv key =
match Environment.GetEnvironmentVariable key with
| x when String.IsNullOrWhiteSpace x -> None
Expand Down Expand Up @@ -50,12 +59,14 @@ let application = application {
//host_config Env.configureHost
}


$"""
Environmental variables
=== Environmental variables ===
GENPRES_URL_ID={tryGetEnv "GENPRES_URL_ID"}
GENPRES_LOG={tryGetEnv "GENPRES_LOG"}
GENPRES_PROD={tryGetEnv "GENPRES_PROD"}
"""
|> printfn "%s"


run application
2 changes: 2 additions & 0 deletions src/Server/ServerApi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ open Shared.Types
open Shared.Api




/// An implementation of the Shared IServerApi protocol.
let serverApi: IServerApi =
{
Expand Down

0 comments on commit dbd92a9

Please sign in to comment.