[backend/startup] Add --https flag & corresponding launch profiles for development purposes

This commit is contained in:
Laura Hausmann 2024-04-23 19:24:42 +02:00
parent f9cc63a179
commit 1a4dd75301
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 27 additions and 1 deletions

View file

@ -17,6 +17,10 @@ public static class StartupHelpers
--recompute-counters Recomputes denormalized database counters.
--migrate-storage Migrates all files currently stored locally to the
configured object storage bucket.
--https For development purposes only. Listens using https
instead of http on the specified port.
--environment <env> Specifies the ASP.NET Core environment. Available options
are 'Development' and 'Production'.
""");
Environment.Exit(0);
}

View file

@ -19,6 +19,16 @@
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"Development (HTTPS)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"externalUrlConfiguration": true,
"commandLineArgs": "--https",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Debug (WASM)": {
"commandName": "Project",
"dotnetRunMessages": true,
@ -29,6 +39,18 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Debug (WASM, HTTPS)": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"externalUrlConfiguration": true,
"commandLineArgs": "--https",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:3000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View file

@ -73,7 +73,7 @@ app.MapFallbackToPage("/Shared/FrontendSPA");
app.Urls.Clear();
if (config.ListenSocket == null)
app.Urls.Add($"http://{config.ListenHost}:{config.ListenPort}");
app.Urls.Add($"{(args.Contains("--https") ? "https" : "http")}://{config.ListenHost}:{config.ListenPort}");
await app.StartAsync();
app.SetKestrelUnixSocketPermissions();