-
Notifications
You must be signed in to change notification settings - Fork 2
/
ModuleSetup.cs
50 lines (47 loc) · 1.98 KB
/
ModuleSetup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Delights.Modules.Bookkeeping;
using Delights.Modules.Notes;
using Delights.Modules.Persons;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Modulight.Modules.Client.RazorComponents;
using Modulight.Modules.Hosting;
namespace Delights.Client.Shared
{
public static class ModuleSetup
{
public static IModuleHostBuilder UseDefaults(this IModuleHostBuilder builder)
{
builder.ConfigureOptions<ServerConfiguration>((o, _) =>
{
o.GraphQLEndpoint = "https://localhost:5001/graphql";
})
.AddModule<UI.UiModule>()
.AddNotesModule(configureOptions: (o, sp) =>
{
var serverConfiguration = sp.GetRequiredService<IOptions<ServerConfiguration>>().Value;
o.GraphQLEndpoint = serverConfiguration.GraphQLEndpoint;
})
.AddPersonsModule(configureOptions: (o, sp) =>
{
var serverConfiguration = sp.GetRequiredService<IOptions<ServerConfiguration>>().Value;
o.GraphQLEndpoint = serverConfiguration.GraphQLEndpoint;
})
.AddBookkeepingModule(configureOptions: (o, sp) =>
{
var serverConfiguration = sp.GetRequiredService<IOptions<ServerConfiguration>>().Value;
o.GraphQLEndpoint = serverConfiguration.GraphQLEndpoint;
});
/*builder.AddHelloModule(configureOptions: (o, sp) =>
{
var serverConfiguration = sp.GetRequiredService<IOptions<ServerConfiguration>>().Value;
o.GraphQLEndpoint = serverConfiguration.GraphQLEndpoint;
})
.AddModuleManagerModule(configureOptions: (o, sp) =>
{
var serverConfiguration = sp.GetRequiredService<IOptions<ServerConfiguration>>().Value;
o.GraphQLEndpoint = serverConfiguration.GraphQLEndpoint;
});*/
return builder;
}
}
}