static int Main(string[] args) { // TODO: Extract this to configuration var result = log4net.Config.BasicConfigurator.Configure(); string couchdb_host = "http://localhost:5984"; string couchdb_name = "config"; string config_id = null; switch (args.Length) { case 3: config_id = args[2]; goto case 2; case 2: couchdb_name = args[1]; goto case 1; case 1: couchdb_host = args[0]; break; } var cts = new Replicator().Start(couchdb_host, couchdb_name, config_id); Logger.Info("Replicator has started."); SetConsoleCtrlHandler((CtrlType) => { cts.Cancel(); return(true); }, true); cts.Token.WaitHandle.WaitOne(); System.Console.ReadKey(); return(0); }