Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit b3c654d

Browse files
make that configurable on the dev server
1 parent 451322a commit b3c654d

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/SqlStreamStore.HAL.DevServer/DevServerStartup.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
internal class DevServerStartup : IStartup
1717
{
1818
private readonly IStreamStore _streamStore;
19+
private readonly SqlStreamStoreMiddlewareOptions _options;
1920

20-
public DevServerStartup(IStreamStore streamStore)
21+
public DevServerStartup(
22+
IStreamStore streamStore,
23+
SqlStreamStoreMiddlewareOptions options)
2124
{
2225
_streamStore = streamStore;
26+
_options = options;
2327
}
2428

2529
public IServiceProvider ConfigureServices(IServiceCollection services) => services
@@ -31,7 +35,7 @@ public void Configure(IApplicationBuilder app) => app
3135
.Use(VaryAccept)
3236
.Use(CatchAndDisplayErrors)
3337
.UseSqlStreamStoreBrowser()
34-
.UseSqlStreamStoreHal(_streamStore);
38+
.UseSqlStreamStoreHal(_streamStore, _options);
3539

3640
private static MidFunc CatchAndDisplayErrors => async (context, next) =>
3741
{

src/SqlStreamStore.HAL.DevServer/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ internal class Program : IDisposable
1616
private readonly IConfigurationRoot _configuration;
1717

1818
private bool Interactive => _configuration.GetValue<bool>("interactive");
19+
private bool UseCanonicalUrls => _configuration.GetValue<bool>("canonical");
1920

2021
public static async Task<int> Main(string[] args)
2122
{
@@ -47,7 +48,10 @@ private async Task<int> Run()
4748
using(var streamStore = await SqlStreamStoreFactory.Create())
4849
using(var host = new WebHostBuilder()
4950
.UseKestrel()
50-
.UseStartup(new DevServerStartup(streamStore))
51+
.UseStartup(new DevServerStartup(streamStore, new SqlStreamStoreMiddlewareOptions
52+
{
53+
UseCanonicalUrls = UseCanonicalUrls
54+
}))
5155
.UseSerilog()
5256
.Build())
5357
{

0 commit comments

Comments
 (0)