Compare commits
2 commits
441546fb93
...
7667bf42e2
Author | SHA1 | Date | |
---|---|---|---|
7667bf42e2 | |||
422b4727c0 |
1 changed files with 13 additions and 0 deletions
|
@ -39,6 +39,19 @@ 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