Compare commits
No commits in common. "61285d6bc4dd4b7b90fbbb530c704be8e43853d7" and "76a335109072bad0dd370c424856fb8db610823a" have entirely different histories.
61285d6bc4
...
76a3351090
@ -12,12 +12,10 @@ open Giraffe
|
|||||||
open dotenv.net
|
open dotenv.net
|
||||||
open Npgsql.FSharp
|
open Npgsql.FSharp
|
||||||
|
|
||||||
DotEnv.Load(DotEnvOptions(envFilePaths = [ "../.prod.env" ], overwriteExistingVars = false))
|
let prodEnv = DotEnv.Read(DotEnvOptions(envFilePaths = [ "../.prod.env"], overwriteExistingVars = false))
|
||||||
|
|
||||||
let connStr = Environment.GetEnvironmentVariable("DATABASE_URL")
|
let ( _ , connStr ) = prodEnv.TryGetValue("DATABASE_URL")
|
||||||
.Replace("postgresql://", "postgres://")
|
let ( _ , apiKey ) = prodEnv.TryGetValue("API_KEY")
|
||||||
.Replace("?sslmode=require", "")
|
|
||||||
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
|
||||||
@ -107,7 +105,8 @@ let main args =
|
|||||||
fun webHostBuilder ->
|
fun webHostBuilder ->
|
||||||
webHostBuilder
|
webHostBuilder
|
||||||
.ConfigureKestrel(fun opt ->
|
.ConfigureKestrel(fun opt ->
|
||||||
opt.AddServerHeader <- false)
|
opt.AddServerHeader <- false
|
||||||
|
opt.ListenLocalhost(3333, (fun o -> o.UseHttps() |> ignore)))
|
||||||
.Configure(Action<IApplicationBuilder> configureApp)
|
.Configure(Action<IApplicationBuilder> configureApp)
|
||||||
.ConfigureServices(configureServices)
|
.ConfigureServices(configureServices)
|
||||||
.ConfigureLogging(configureLogging)
|
.ConfigureLogging(configureLogging)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments="CurrencyAPI.dll" stdoutLogEnabled="false" stdoutLogFile="logs/stdout" />
|
<aspNetCore processPath="dotnet" arguments="CurrencyAPI.dll" stdoutLogEnabled="false" stdoutLogFile="logs/stdout" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
|
10
Dockerfile
10
Dockerfile
@ -10,16 +10,14 @@ RUN dotnet tool restore
|
|||||||
|
|
||||||
RUN dotnet restore "CurrencyAPI/CurrencyAPI.fsproj"
|
RUN dotnet restore "CurrencyAPI/CurrencyAPI.fsproj"
|
||||||
|
|
||||||
WORKDIR "/src/CurrencyAPI/"
|
WORKDIR "/src/Bot"
|
||||||
|
|
||||||
RUN dotnet build "CurrencyAPI.fsproj" -c Release -o /app/build
|
RUN dotnet build "CurrencyAPI.fsproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish --no-restore
|
RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
EXPOSE 80
|
ENTRYPOINT "./CurrencyAPI.App"
|
||||||
EXPOSE 443
|
|
||||||
ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ]
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user