mirror of https://github.com/Ombi-app/Ombi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
using Mono.Data.Sqlite;
|
|
|
|
using Nancy;
|
|
using Nancy.Authentication.Forms;
|
|
using Nancy.Bootstrapper;
|
|
using Nancy.Diagnostics;
|
|
using Nancy.Session;
|
|
using Nancy.TinyIoc;
|
|
|
|
using RequestPlex.Core;
|
|
using RequestPlex.Core.SettingModels;
|
|
using RequestPlex.Helpers;
|
|
using RequestPlex.Store;
|
|
using RequestPlex.Store.Repository;
|
|
|
|
using FormsAuthentication = Nancy.Authentication.Forms.FormsAuthentication;
|
|
|
|
namespace RequestPlex.UI
|
|
{
|
|
public class Bootstrapper : DefaultNancyBootstrapper
|
|
{
|
|
// The bootstrapper enables you to reconfigure the composition of the framework,
|
|
// by overriding the various methods and properties.
|
|
// For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
|
|
|
|
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
|
|
{
|
|
container.Register<IUserMapper, UserMapper>();
|
|
|
|
container.Register<ISqliteConfiguration, DbConfiguration>(new DbConfiguration(new SqliteFactory()));
|
|
|
|
container.Register<ISettingsRepository, JsonRepository>();
|
|
container.Register<ICacheProvider, MemoryCacheProvider>();
|
|
|
|
container.Register<ISettingsService<RequestPlexSettings>, SettingsServiceV2<RequestPlexSettings>>();
|
|
container.Register<ISettingsService<CouchPotatoSettings>, SettingsServiceV2<CouchPotatoSettings>>();
|
|
container.Register<IRepository<RequestedModel>, GenericRepository<RequestedModel>>();
|
|
|
|
base.ConfigureRequestContainer(container, context);
|
|
}
|
|
|
|
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
|
{
|
|
CookieBasedSessions.Enable(pipelines);
|
|
StaticConfiguration.DisableErrorTraces = false;
|
|
|
|
base.ApplicationStartup(container, pipelines);
|
|
|
|
// Enable forms auth
|
|
var formsAuthConfiguration = new FormsAuthenticationConfiguration
|
|
{
|
|
RedirectUrl = "~/login",
|
|
UserMapper = container.Resolve<IUserMapper>()
|
|
};
|
|
|
|
FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
|
|
}
|
|
|
|
protected override DiagnosticsConfiguration DiagnosticsConfiguration => new DiagnosticsConfiguration { Password = @"password" };
|
|
}
|
|
} |