using System;
using System.IO;
namespace ClassNotify.Server.Configuration;
///
/// 客户端在线升级包存储配置选项 (P2.5 RC1-4)
///
public class UpdateStorageOptions
{
///
/// 更新包根存储目录 (必须为绝对路径,若为空则自动使用默认或环境变量)
///
public string? StorageRoot { get; set; }
///
/// 解析最终生效的 StorageRoot 规范化绝对路径
///
public string GetEffectiveStorageRoot()
{
if (!string.IsNullOrWhiteSpace(StorageRoot))
{
return Path.GetFullPath(StorageRoot);
}
var env = Environment.GetEnvironmentVariable("CLASSNOTIFY_UPDATE_STORAGE");
if (!string.IsNullOrWhiteSpace(env))
{
return Path.GetFullPath(env);
}
return Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "storage", "updates"));
}
}