2020-06-03 14:53:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using ASC.Common.Utils;
|
|
|
|
|
|
|
|
|
|
namespace ASC.Feed.Configuration
|
|
|
|
|
{
|
|
|
|
|
public class FeedSettings
|
|
|
|
|
{
|
|
|
|
|
public string ServerRoot { get; set; }
|
|
|
|
|
|
|
|
|
|
public TimeSpan AggregatePeriod { get; set; }
|
|
|
|
|
|
|
|
|
|
public TimeSpan AggregateInterval { get; set; }
|
|
|
|
|
|
|
|
|
|
public TimeSpan RemovePeriod { get; set; }
|
|
|
|
|
|
2020-11-24 10:15:11 +00:00
|
|
|
|
public static FeedSettings GetInstance(ConfigurationExtension configuration)
|
2020-06-04 10:54:13 +00:00
|
|
|
|
{
|
|
|
|
|
var result = configuration.GetSetting<FeedSettings>("feed");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(result.ServerRoot))
|
|
|
|
|
{
|
|
|
|
|
result.ServerRoot = "http://*/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.AggregatePeriod == TimeSpan.Zero)
|
|
|
|
|
{
|
|
|
|
|
result.AggregatePeriod = TimeSpan.FromMinutes(5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.AggregateInterval == TimeSpan.Zero)
|
|
|
|
|
{
|
|
|
|
|
result.AggregateInterval = TimeSpan.FromDays(14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.RemovePeriod == TimeSpan.Zero)
|
|
|
|
|
{
|
|
|
|
|
result.RemovePeriod = TimeSpan.FromDays(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2020-06-03 14:53:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|