Files
mixtape/zero.Core/Options/ZeroOptions.cs
T

206 lines
4.6 KiB
C#
Raw Normal View History

using System;
2020-08-05 15:48:43 +02:00
using System.Collections.Generic;
2021-03-18 13:23:39 +01:00
using zero.Core.Entities;
2020-05-13 14:06:11 +02:00
namespace zero.Core.Options
{
public class ZeroOptions : IZeroOptions
{
public ZeroOptions()
{
SupportedLanguages = new string[2] { "en-US", "de-DE" };
DefaultLanguage = SupportedLanguages[0];
2021-01-29 17:01:32 +01:00
TokenExpiration = 60 * 3;
BackofficePath = "/zero";
2021-01-13 23:50:03 +01:00
ExcludedPaths = new() { };
Raven = new()
{
CollectionPrefix = String.Empty
};
2021-01-13 23:50:03 +01:00
Sections = new();
Features = new();
Pages = new();
Modules = new();
Permissions = new();
Settings = new();
Spaces = new();
Integrations = new();
Icons = new();
2021-02-03 14:15:15 +01:00
Services = new();
2021-02-23 15:50:33 +01:00
Routing = new();
}
2020-12-02 15:45:44 +01:00
/// <inheritdoc />
public bool SetupCompleted => !String.IsNullOrEmpty(Raven?.Database);
/// <inheritdoc />
public string ZeroVersion { get; set; }
/// <inheritdoc />
public string DefaultLanguage { get; set; }
/// <inheritdoc />
public string[] SupportedLanguages { get; private set; }
/// <inheritdoc />
public int TokenExpiration { get; set; }
/// <inheritdoc />
public RavenOptions Raven { get; set; }
/// <inheritdoc />
2020-04-05 01:19:42 +02:00
public string BackofficePath { get; set; }
2020-08-05 15:48:43 +02:00
/// <summary>
/// Paths in the backoffice which are not handled by zero
/// </summary>
public List<string> ExcludedPaths { get; private set; }
/// <inheritdoc />
//public IZeroPluginConfiguration Backoffice { get; set; }
2020-05-13 14:06:11 +02:00
/// <inheritdoc />
public SectionOptions Sections { get; private set; }
/// <inheritdoc />
public FeatureOptions Features { get; private set; }
/// <inheritdoc />
public PageOptions Pages { get; private set; }
2020-08-19 11:22:45 +02:00
/// <inheritdoc />
public ModuleOptions Modules { get; private set; }
/// <inheritdoc />
public PermissionOptions Permissions { get; private set; }
/// <inheritdoc />
public SettingsOptions Settings { get; private set; }
/// <inheritdoc />
public SpaceOptions Spaces { get; private set; }
2020-12-10 15:57:59 +01:00
/// <inheritdoc />
public IntegrationOptions Integrations { get; private set; }
/// <inheritdoc />
public IconOptions Icons { get; private set; }
2021-02-03 14:15:15 +01:00
/// <inheritdoc />
public ServiceOptions Services { get; private set; }
2021-02-23 15:50:33 +01:00
/// <inheritdoc />
public RoutingOptions Routing { get; private set; }
}
public class RavenOptions
{
public string Url { get; set; }
public string Database { get; set; }
public string CollectionPrefix { get; set; }
}
public interface IZeroOptions
{
2020-12-02 15:45:44 +01:00
/// <summary>
/// Whether the zero setup has already been completed and the instance is ready for use
/// </summary>
bool SetupCompleted { get; }
/// <summary>
/// The currently active version
/// This should not be set manually, as it is used for setup and migrations and incremented automatically
/// </summary>
string ZeroVersion { get; set; }
/// <summary>
/// Default language ISO code
/// </summary>
string DefaultLanguage { get; set; }
/// <summary>
/// Language ISO codes which are supported by the zero backoffice
/// </summary>
string[] SupportedLanguages { get; }
/// <summary>
/// Expiration in minutes of a generated change token for an entity
/// </summary>
int TokenExpiration { get; set; }
/// <summary>
/// RavenDB configuration data
/// </summary>
RavenOptions Raven { get; set; }
/// <summary>
/// URL path to the backoffice (defaults to /zero)
/// </summary>
string BackofficePath { get; set; }
2020-08-05 15:48:43 +02:00
/// <summary>
/// Paths in the backoffice which are not handled by zero
/// </summary>
List<string> ExcludedPaths { get; }
/// <summary>
///
/// </summary>
SectionOptions Sections { get; }
/// <summary>
///
/// </summary>
FeatureOptions Features { get; }
/// <summary>
///
/// </summary>
PageOptions Pages { get; }
2020-08-19 11:22:45 +02:00
/// <summary>
///
/// </summary>
ModuleOptions Modules { get; }
/// <summary>
///
/// </summary>
PermissionOptions Permissions { get; }
/// <summary>
///
/// </summary>
SettingsOptions Settings { get; }
/// <summary>
///
/// </summary>
SpaceOptions Spaces { get; }
2020-12-10 15:57:59 +01:00
/// <summary>
///
/// </summary>
IntegrationOptions Integrations { get; }
/// <summary>
///
/// </summary>
IconOptions Icons { get; }
2021-02-03 14:15:15 +01:00
/// <summary>
///
/// </summary>
ServiceOptions Services { get; }
2021-02-23 15:50:33 +01:00
/// <summary>
///
/// </summary>
RoutingOptions Routing { get; }
2020-05-19 14:42:51 +02:00
}
}