FlexitimeTracker/DataCenter_Windows/WindowsDataCenter/CardReaderService/Configuration.cs
Chris.Watts90@outlook.com b20a506d3a removed hardcoded string for WebApp endpoint (previously "http://*:8800")
The app now pulls in the port from the app.config file.
Also added some commented out code to load a config file in a different directory (i.e.: to allow config files in "configs" directory to be pulled in).
If the port isnt specified in the app.config, will default to 8800.
#27
2017-03-21 21:44:23 +00:00

36 lines
1.1 KiB
C#

using System;
using System.IO;
using System.Reflection;
using CardReaderService.DefaultComponents;
using Interfaces;
using Ninject;
namespace CardReaderService
{
public static class Configuration
{
public static StandardKernel ConfigureNinject()
{
var kernel = new StandardKernel();
var ninjectConfigPath =
new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), "NinjectConfig.xml"))
.LocalPath;
if (File.Exists(ninjectConfigPath))
{
kernel.Load(ninjectConfigPath);
}
var logger = kernel.TryGet<ILogger>();
if (logger == null)
{
kernel.Bind<ILogger>().To<DefaultLogger>();
logger = kernel.Get<ILogger>();
}
logger.Fatal("test message - ninject stuff loaded.");
logger.Trace("NinjectConfig.xml is here: {0}", ninjectConfigPath);
logger.Trace("got logger: {0}", logger.GetType());
return kernel;
}
}
}