BuildFeed/MongoAuth/DatabaseConfig.cs
Thomas Hounsell d3dc24db5c Surprise MongoDB Move, PWestminster App
Shock move to MongoDB (issue #18) started with integrating the MongoDB
MemberProvider from checkHashes. Still to complete, though user
registration and role setup confirmed working.

I've also started a Project Westminster App to tide us over til we get
the chance to do a proper  application with a new API that will be much
easier once the MongoDB switch is complete.
2015-08-04 21:07:31 +01:00

26 lines
914 B
C#

using System.Configuration;
namespace MongoAuth
{
internal static class DatabaseConfig
{
public static string Host { get; private set; }
public static int Port { get; private set; }
public static string Database { get; private set; }
static DatabaseConfig()
{
Host = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoHost"]) ? ConfigurationManager.AppSettings["data:MongoHost"] : "localhost";
int _port;
bool success = int.TryParse(ConfigurationManager.AppSettings["data:MongoPort"], out _port);
if (!success)
{
_port = 27017; // mongo default port
}
Port = _port;
Database = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoDB"]) ? ConfigurationManager.AppSettings["data:MongoDB"] : "MongoAuth";
}
}
}