public TokenController(IMemoryFlow flow, IOptions <ApplicationOptions> options, PageFactoryManager pageFactoryManager, ILogger <TokenController> logger) { _flow = flow; _options = options.Value; _pageFactoryManager = pageFactoryManager; _logger = logger; }
public void ConfigureServices(IServiceCollection services) { services.AddProblemDetailsErrorHandling(); services.AddControllers(); services.Configure <ApplicationOptions>(appOptions => { appOptions.Store[Applications.Matsumoto] = new BaseUrlOptions { ApiEndpoint = Configuration["Applications:Matsumoto:ApiEndpoint"], Application = Configuration["Applications:Matsumoto:Application"] }; appOptions.Store[Applications.Shuri] = new BaseUrlOptions { ApiEndpoint = Configuration["Applications:Shuri:ApiEndpoint"], Application = Configuration["Applications:Shuri:Application"] }; }); services.AddSingleton(provider => { var options = provider.GetService <IOptions <ApplicationOptions> >(); var factory = new PageFactoryManager(options); factory.Init().GetAwaiter().GetResult(); return(factory); }); services .AddMemoryCache() .AddMemoryFlow() .AddHealthChecks() .AddCheck <ControllerResolveHealthCheck>(nameof(ControllerResolveHealthCheck)); services.AddSwaggerGen(options => { options.SwaggerDoc("v1.0", new OpenApiInfo { Title = "HappyTravel.com Dev get token API", Version = "v1.0" }); }); services.AddMvcCore() .AddControllersAsServices() .AddJsonOptions(options => { options.JsonSerializerOptions.WriteIndented = false; options.JsonSerializerOptions.IgnoreNullValues = true; options.JsonSerializerOptions.PropertyNameCaseInsensitive = true; options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase, false)); }); }