private ILeanKitApi Connect(Request request, bool saveLogin = false)
        {
            LeanKitClientFactory = new LeanKitClientFactory();
            var account = new LeanKitBasicAuth
            {
                Hostname            = request.Host,
                Username            = request.User,
                Password            = request.Password,
                UrlTemplateOverride = request.Host
            };

            if (saveLogin)
            {
                SaveLogin(account);
            }

            // expand host if necessary
            if (account.Hostname == "kanban-cibuild")
            {
                account.UrlTemplateOverride = "http://kanban-cibuild.localkanban.com/";
            }
            else if (!account.Hostname.StartsWith("http:") && !account.Hostname.StartsWith("https:"))
            {
                account.UrlTemplateOverride = "https://" + account.Hostname + ".leankit.com/";
            }
            else
            {
                account.UrlTemplateOverride = account.Hostname;
            }

            string.Format("Attempting connection to {0}", request).Debug();

            return(LeanKitClientFactory.Create(account));
        }
Exemple #2
0
        //TODO: would be great if we could reload configuration for just a single board

        private void ConnectToLeanKit()
        {
            LeanKitAccount = new LeanKitAccountAuth
            {
                Hostname            = Configuration.LeanKit.Url,
                UrlTemplateOverride = GetTemplateOverride(Configuration.LeanKit.Url),
                Username            = Configuration.LeanKit.User,
                Password            = Configuration.LeanKit.Password
            };

            try
            {
                Log.Debug("Connecting to LeanKit account [{0}] with account [{1}]", LeanKitAccount.Hostname, LeanKitAccount.Username);
                LeanKit = LeanKitClientFactory.Create(LeanKitAccount);
            }
            catch (Exception ex)
            {
                Log.Error("Failed to open LeanKit API: " + ex.Message);
            }
        }
		private ILeanKitApi Connect(Request request, bool saveLogin = false)
		{

			LeanKitClientFactory = new LeanKitClientFactory();
			var account = new LeanKitAccountAuth
				{
					Hostname = request.Host,
					Username = request.User,
					Password = request.Password,
					UrlTemplateOverride = request.Host
				};

			if (saveLogin) SaveLogin(account);

			// expand host if necessary
			if (account.Hostname == "kanban-cibuild")
				account.UrlTemplateOverride = "http://kanban-cibuild.localkanban.com/";
			else if (!account.Hostname.Contains("http://"))
				account.UrlTemplateOverride = "https://" + account.Hostname + ".leankit.com/";
			
			string.Format("Attempting connection to {0}", request).Debug();

			return LeanKitClientFactory.Create(account);

		}