public async Task <bool> IsRegistered() { try { var response = await KongHttpClient.GetAsync($"/services/{KongServiceSettings.Name}"); return(response.StatusCode == System.Net.HttpStatusCode.OK); } catch { return(false); } }
public async Task <bool> IsRunning() { try { var response = await KongHttpClient.GetStringAsync("/"); return(response.Length > 0); } catch { return(false); } }
public async Task Register() { if (await IsRegistered()) { return; } await KongHttpClient.PostAsJsonAsync("/services", new { name = KongServiceSettings.Name, url = $"https://{ServiceSettings.LocalUrl}:443" }); await KongHttpClient.PostAsJsonAsync($"/services/{KongServiceSettings.Name}/routes", new { preserve_host = true, paths = new List <string>() { $"/{ServiceSettings.Path}" } }); }