Skip to content

Commit

Permalink
Support of Shared Web Hosting Added
Browse files Browse the repository at this point in the history
- Ensured that if application log directory as configured in Parameters.config cannot be created on remote host, a fallback path would be used.
- Added a feature on ApprovedDomain to enable users to specify database name explicitly if the application was not hosted on a multi-tenancy environment but a shared one.
- Updated tenant convention to also understand the configuration "DatabaseName" present in ApprovedDomains.json.
  • Loading branch information
binodnp committed May 13, 2019
1 parent b53f5ce commit b7afd9b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3,521 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ src/Frapid.Web/Areas/MixERP.CountryPacks.Nepal/
/src/Frapid.Web/Areas/MixERP.CountryPacks.Nepal
/src/Frapid.Web/Areas/Frapid.Customizations
/src/Frapid.Web/Areas/MixERP.EmployeePortal
/src/Frapid.Web/Resource/Temp
.vs
20 changes: 15 additions & 5 deletions src/Frapid.Web/Application/LogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@ internal static class LogManager
{
private static string GetLogDirectory()
{
string fallbackPath = PathMapper.MapPath("~/Resource/Temp");
string path = ConfigurationManager.GetConfigurationValue("ParameterConfigFileLocation", "ApplicationLogDirectory");

if (string.IsNullOrWhiteSpace(path))
{
return PathMapper.MapPath("~/Resource/Temp");
return fallbackPath;
}

if (!Directory.Exists(path))
try
{
Directory.CreateDirectory(path);
}
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

return path;
return path;
}
catch
{
//It is counterproductive to log errors
//when you know that you don't have access to the log directory
return fallbackPath;
}
}

private static string GetLogFileName()
Expand Down
Empty file.
Empty file.
3,516 changes: 0 additions & 3,516 deletions src/Frapid.Web/Resource/Temp/2-19-2017/log-20170220.txt

This file was deleted.

2 changes: 2 additions & 0 deletions src/Libraries/Frapid.Configuration/ApprovedDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public class ApprovedDomain
{
public string DbProvider { get; set; }
public string DomainName { get; set; }

public string DatabaseName { get; set; }
public string BackupDirectory { get; set; }
public bool BackupDirectoryIsFixedPath { get; set; }
public bool EnforceSsl { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public string GetTenantName(string domain, string or)

if (tenant != null)
{
if (!string.IsNullOrWhiteSpace(tenant.DatabaseName))
{
Log.Verbose($"Database name override ${tenant.DatabaseName} found for domain \"{domain}\". Tenant domain: \"{tenant.DomainName}\".");
return tenant.DatabaseName;
}

Log.Verbose($"Tenant found for domain \"{domain}\". Tenant domain: \"{tenant.DomainName}\".");
return this.ConvertToTenantName(tenant.DomainName);
}
Expand Down

0 comments on commit b7afd9b

Please sign in to comment.