Skip to content

Commit 5215948

Browse files
committed
api: update dotnet to 9.0 and move Env configuration to their specific file + module
1 parent c668b7a commit 5215948

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

fsharp-api/.config/dotnet-tools.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"isRoot": true,
44
"tools": {
55
"fantomas": {
6-
"version": "6.1.1",
6+
"version": "7.0.1",
77
"commands": [
88
"fantomas"
9-
]
9+
],
10+
"rollForward": false
1011
}
1112
}
1213
}

fsharp-api/Env.fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Env
2+
3+
open System
4+
5+
let private setEnvVarDefaultValue (defaultValue: string) (readEnvVar: string) =
6+
match readEnvVar with
7+
| null -> defaultValue
8+
| _ -> readEnvVar
9+
10+
let HOST =
11+
Environment.GetEnvironmentVariable "HOST" |> setEnvVarDefaultValue "localhost"
12+
13+
let PORT = Environment.GetEnvironmentVariable "PORT" |> setEnvVarDefaultValue "8085"

fsharp-api/FsharpAPI.fsproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77
<ItemGroup>
8+
<Compile Include="Env.fs" />
89
<Compile Include="src/DataScience/DataScience.fs" />
910
<Compile Include="src/Monitoring/Prometheus.fs" />
1011
<Compile Include="src/Controllers/Health.controller.fs" />
@@ -22,4 +23,4 @@
2223
<PackageReference Include="prometheus-net.AspNetCore" Version="8.0.1" />
2324
<PackageReference Include="Saturn" Version="0.16.1" />
2425
</ItemGroup>
25-
</Project>
26+
</Project>

fsharp-api/Program.fs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
open Saturn
22

3-
open System
4-
53
open API.Server
64

7-
let setEnvVarDefaultValue (defaultValue: string) (readEnvVar: string) =
8-
match readEnvVar with
9-
| null -> defaultValue
10-
| _ -> readEnvVar
11-
12-
let HOST: string =
13-
Environment.GetEnvironmentVariable "HOST" |> setEnvVarDefaultValue "localhost"
14-
15-
let PORT: string =
16-
Environment.GetEnvironmentVariable "PORT" |> setEnvVarDefaultValue "8085"
17-
185
[<EntryPoint>]
19-
let main (args: string[]) =
20-
run (serverConfig (HOST) (PORT))
6+
let main (_args: string[]) =
7+
do run (serverConfig (Env.HOST) (Env.PORT))
218
0

0 commit comments

Comments
 (0)