Compare commits

...

10 Commits

Author SHA1 Message Date
61285d6bc4 Fixing some DB stuff I guess 2023-02-27 18:14:42 +07:00
3d1a863ab5 Whitespace it seems 2022-08-04 13:50:32 +07:00
9e4a37baab Do the thing with the postgres url 2022-07-21 15:20:10 +07:00
f921d7b123 Get the environment variable properly 2022-07-21 15:12:24 +07:00
b86adff83d Remove https 2022-07-21 14:46:54 +07:00
fc04e5f2b5 Try this 2022-07-21 14:38:24 +07:00
489a39c06a Try the expose 2022-07-21 14:32:07 +07:00
fab68a5d39 See if this fixes it 2022-07-20 18:41:02 +07:00
e00f3a865e AspNetCoreModuleV2 2022-07-20 18:30:52 +07:00
2ac29d526c Oh vey 2022-07-20 18:25:50 +07:00
5 changed files with 28 additions and 25 deletions

View File

@ -12,10 +12,12 @@ open Giraffe
open dotenv.net
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 ( _ , apiKey ) = prodEnv.TryGetValue("API_KEY")
let connStr = Environment.GetEnvironmentVariable("DATABASE_URL")
.Replace("postgresql://", "postgres://")
.Replace("?sslmode=require", "")
let apiKey = Environment.GetEnvironmentVariable("API_KEY")
let validateApiKey (ctx : HttpContext) =
match ctx.TryGetRequestHeader "X-API-Key" with
@ -105,8 +107,7 @@ let main args =
fun webHostBuilder ->
webHostBuilder
.ConfigureKestrel(fun opt ->
opt.AddServerHeader <- false
opt.ListenLocalhost(3333, (fun o -> o.UseHttps() |> ignore)))
opt.AddServerHeader <- false)
.Configure(Action<IApplicationBuilder> configureApp)
.ConfigureServices(configureServices)
.ConfigureLogging(configureLogging)

View File

@ -2,7 +2,7 @@
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments="CurrencyAPI.dll" stdoutLogEnabled="false" stdoutLogFile="logs/stdout" />
</system.webServer>

View File

@ -10,14 +10,16 @@ RUN dotnet tool restore
RUN dotnet restore "CurrencyAPI/CurrencyAPI.fsproj"
WORKDIR "/src/Bot"
WORKDIR "/src/CurrencyAPI/"
RUN dotnet build "CurrencyAPI.fsproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish
RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish --no-restore
FROM base AS final
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT "./CurrencyAPI.App"
EXPOSE 80
EXPOSE 443
ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ]