ปรับให้ระบบอ่านค่าจาก env ทั้งหมด

This commit is contained in:
Nakorn Rientrakrunchai
2020-06-12 12:15:37 +07:00
parent eea05beb69
commit c293ef770d
96 changed files with 191 additions and 1548 deletions

View File

@@ -96,15 +96,11 @@ namespace TodoAPI2.Controllers
{
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
var httpclient = new WebClient();
var env_mainurl = Environment.GetEnvironmentVariable("JasperReportServer_MainURL");
var env_reportsite = Environment.GetEnvironmentVariable("JasperReportServer_reportsite");
var env_username = Environment.GetEnvironmentVariable("JasperReportServer_username");
var env_password = Environment.GetEnvironmentVariable("JasperReportServer_password");
string mainurl = !string.IsNullOrEmpty(env_mainurl) ? env_mainurl : Configuration["JasperReportServer:MainURL"];
string reportsite = !string.IsNullOrEmpty(env_reportsite) ? env_reportsite : Configuration["JasperReportServer:reportsite"];
string username = !string.IsNullOrEmpty(env_username) ? env_username : Configuration["JasperReportServer:username"];
string password = !string.IsNullOrEmpty(env_password) ? env_password : Configuration["JasperReportServer:password"];
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
string url = $"{mainurl}{reportsite}/rep_leave_total_02.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";