49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
namespace Lagerbestand.Models;
|
|
|
|
/// <summary>
|
|
/// File storage settings for NFS/disk-based file storage
|
|
/// </summary>
|
|
public class FileStorageSettings
|
|
{
|
|
/// <summary>
|
|
/// Base path for file storage (e.g., /mnt/nfs/attachments or C:\Storage\Attachments)
|
|
/// </summary>
|
|
public string BasePath { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Whether file storage is configured and enabled
|
|
/// </summary>
|
|
public bool IsEnabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// Maximum file size in bytes (default: 10 MB)
|
|
/// </summary>
|
|
public long MaxFileSizeBytes { get; set; } = 10 * 1024 * 1024;
|
|
|
|
/// <summary>
|
|
/// Validates if the storage path is accessible
|
|
/// </summary>
|
|
public bool IsPathAccessible()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(BasePath))
|
|
return false;
|
|
|
|
try
|
|
{
|
|
return Directory.Exists(BasePath);
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the full path for a given relative file path
|
|
/// </summary>
|
|
public string GetFullPath(string relativePath)
|
|
{
|
|
return Path.Combine(BasePath, relativePath);
|
|
}
|
|
}
|