<commit_before>﻿using System;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Database.Server;

namespace SnittListan.Installers
{
	public class RavenInstaller : IWindsorInstaller
	{
		public void Install(IWindsorContainer container, IConfigurationStore store)
		{
			container.Register(
					Component.For<IDocumentStore>().Instance(CreateDocumentStore()).LifeStyle.Singleton,
					Component.For<IDocumentSession>().UsingFactoryMethod(GetDocumentSession).LifeStyle.PerWebRequest);
		}

		private static IDocumentSession GetDocumentSession(IKernel kernel)
		{
			var store = kernel.Resolve<IDocumentStore>();
			return store.OpenSession();
		}

		private IDocumentStore CreateDocumentStore()
		{
			var store = new EmbeddableDocumentStore
			{
				DataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory").ToString(),
				UseEmbeddedHttpServer = true
			}.Initialize();

			store.Conventions.IdentityPartsSeparator = "-";
			return store;
		}
	}
}<commit_msg>Don't run embedded http server when in production<commit_after>﻿using System;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Database.Server;

namespace SnittListan.Installers
{
	public class RavenInstaller : IWindsorInstaller
	{
		public void Install(IWindsorContainer container, IConfigurationStore store)
		{
			container.Register(
					Component.For<IDocumentStore>().Instance(CreateDocumentStore()).LifeStyle.Singleton,
					Component.For<IDocumentSession>().UsingFactoryMethod(GetDocumentSession).LifeStyle.PerWebRequest);
		}

		private static IDocumentSession GetDocumentSession(IKernel kernel)
		{
			var store = kernel.Resolve<IDocumentStore>();
			return store.OpenSession();
		}

		private IDocumentStore CreateDocumentStore()
		{
			var store = new EmbeddableDocumentStore
			{
				DataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory").ToString(),
#if DEBUG
				UseEmbeddedHttpServer = true
#endif
			}.Initialize();

			store.Conventions.IdentityPartsSeparator = "-";
			return store;
		}
	}
}
{'fraction_non_alphanumeric': 0.09575863576738085, 'fraction_numerical': 0.0, 'mean_word_length': 5.481586402266289, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801969', 'n_tokens_mistral': 737, 'n_tokens_neox': 632, 'n_words': 122}