Compare commits
2 commits
7667bf42e2
...
441546fb93
Author | SHA1 | Date | |
---|---|---|---|
441546fb93 | |||
1ddf80cb8c |
1 changed files with 0 additions and 13 deletions
|
@ -39,19 +39,6 @@ namespace Server {
|
||||||
services.AddSingleton<IDatabase, Database>();
|
services.AddSingleton<IDatabase, Database>();
|
||||||
services.AddSingleton(NodaTime.DateTimeZoneProviders.Tzdb);
|
services.AddSingleton(NodaTime.DateTimeZoneProviders.Tzdb);
|
||||||
|
|
||||||
services.AddSingleton<IFileStorage>((serviceProvider) => {
|
|
||||||
var conf = serviceProvider.GetRequiredService<IConfiguration>();
|
|
||||||
var section = conf.GetSection("FileStorage");
|
|
||||||
switch (section["Type"]) {
|
|
||||||
case "local": {
|
|
||||||
var dir = section["Directory"];
|
|
||||||
return new LocalFileStorage(dir!);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
throw new Exception("Unable to configure FileStorage");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
services.AddControllers()
|
services.AddControllers()
|
||||||
.AddNewtonsoftJson(options => {
|
.AddNewtonsoftJson(options => {
|
||||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver {
|
options.SerializerSettings.ContractResolver = new DefaultContractResolver {
|
||||||
|
|
Loading…
Add table
Reference in a new issue