Skip to content

Commit

Permalink
Configurable REDIS url
Browse files Browse the repository at this point in the history
  • Loading branch information
driis committed Dec 15, 2012
1 parent 4459af8 commit ced01ef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
7 changes: 5 additions & 2 deletions MobileVehicleInspection.Api/Services/ServiceStackAppHost.cs
@@ -1,4 +1,5 @@
using System.Web;
using System.Configuration;
using System.Web;
using Funq;
using MobileVehicleInspection.Api.Library;
using ServiceStack.CacheAccess;
Expand All @@ -24,10 +25,12 @@ public override void Configure(Container container)
container.Register(new ScraperSettings{
UrlTemplate = "http://selvbetjening.trafikstyrelsen.dk/Sider/resultater.aspx?{0}={1}"
});

string redisUrl = ConfigurationManager.AppSettings["REDISCLOUD_URL"];
container.RegisterAutoWired<DanishTransportAuthorityScraper>();
container.RegisterAutoWired<DanishTransportAuthorityResponseParser>();
container.Register<IVehicleInspectionLookup>(c => new CacheVehicleInspectionLookup(c.Resolve<ICacheClient>(), c.Resolve<DanishTransportAuthorityScraper>()));
container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));
container.Register<IRedisClientsManager>(c => new PooledRedisClientManager(redisUrl));
container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
}

Expand Down
33 changes: 15 additions & 18 deletions MobileVehicleInspection.Api/Web.config
@@ -1,18 +1,15 @@
<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<handlers>
<add name="ServiceStack.Factory" path="api/v1" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true"/>
</handlers>
</system.webServer>
</configuration>
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="REDISCLOUD_URL" value="localhost:6379"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<handlers>
<add name="ServiceStack.Factory" path="api/v1" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true"/>
</handlers>
</system.webServer>
</configuration>

0 comments on commit ced01ef

Please sign in to comment.