blob: 4c757d6bfade023189a5796dcc69d62f34cfb4ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module FundLab.Api.Program
open System
open Giraffe
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.DependencyInjection
let private requiredEnvironment name =
match Environment.GetEnvironmentVariable(name) with
| value when not (String.IsNullOrWhiteSpace value) -> value
| _ -> failwithf "%s must be configured" name
[<EntryPoint>]
let main argv =
let builder = WebApplication.CreateBuilder(argv)
builder.Services.AddGiraffe() |> ignore
let repository = FundRepository(requiredEnvironment "FUND_LAB_DATABASE_URL")
repository.EnsureSchema()
let app = builder.Build()
app.UseGiraffe(App.createApplication(repository))
app.Run()
0
|