public async Task <IActionResult> AppConfig() { HerokuAppConfig appConfig = new HerokuAppConfig(); try { Console.WriteLine("Get App Config Start"); string resourceId = HttpContext.GetClaimValue(ClaimTypes.NameIdentifier); HerokuApi.PostlogMessage("Get App Config Start", resourceId); var herokuAuthToken = HttpContext.GetClaimValue(Constants.HEROKU_ACCESS_TOKEN); //Get resource info from resourses table by resource id appConfig.resource = _dedupSettingsRepository.GetResource(resourceId).ToResource(); if (!string.IsNullOrEmpty(herokuAuthToken)) { //Get addons details of the main app appConfig.addons = HerokuApi.GetHerokuAppAddons(appConfig.resource.app_name, herokuAuthToken); //Commented on 24th May, 2020 due to partner auth token not permitted to access ////Get config_vars of the main app //appConfig.config_vars = HerokuApi.GetHerokuAppConfigVars(appConfig.resource.app_name, herokuAuthToken); } Console.WriteLine("Get App Config End"); HerokuApi.PostlogMessage("Get App Config End", resourceId); } catch (Exception ex) { Console.WriteLine("ERROR: {0}", ex.Message); } return(View(await Task.FromResult(appConfig))); }
public JsonResult GetConfigVar(string name) { string conValue = string.Empty; try { Console.WriteLine("Get Config Variable Start"); string resourceId = HttpContext.GetClaimValue(ClaimTypes.NameIdentifier); HerokuApi.PostlogMessage("Get Config Variable Start", resourceId); if (!string.IsNullOrEmpty(name)) { //Get heroku auth token from session var herokuAuthToken = HttpContext.GetClaimValue(Constants.HEROKU_ACCESS_TOKEN); //Get heroku app name from resources table by resource id var appName = _dedupSettingsRepository.GetHerokuAppName(resourceId); if (!string.IsNullOrEmpty(appName) && !string.IsNullOrEmpty(herokuAuthToken)) { //Get config var value conValue = HerokuApi.GetHerokuAppConfigVarByName(appName, name, herokuAuthToken); } } Console.WriteLine("Get Config Variable Start"); HerokuApi.PostlogMessage("Get Config Variable End", resourceId); } catch (Exception ex) { Console.WriteLine("ERROR: {0}", ex.Message); } return(Json(new { Value = conValue })); }