v1.0
This commit is contained in:
13
ProjectManager.Backend/Options/GeneralOptions.cs
Normal file
13
ProjectManager.Backend/Options/GeneralOptions.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace ProjectManager.Backend.Options;
|
||||
|
||||
public class GeneralOptions : OptionsFromConfiguration {
|
||||
public override string Position { get; set; } = "General";
|
||||
|
||||
public string Database { get; set; }
|
||||
public int TokenTimeInDays { get; set; }
|
||||
public string PortRange { get; set; }
|
||||
public string DockerPath { get; set; }
|
||||
public string Root { get; set; }
|
||||
public string PocketBaseVersion { get; set; }
|
||||
public int MaxProjects { get; set; }
|
||||
}
|
||||
21
ProjectManager.Backend/Options/OptionsFromConfiguration.cs
Normal file
21
ProjectManager.Backend/Options/OptionsFromConfiguration.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace ProjectManager.Backend.Options;
|
||||
|
||||
public abstract class OptionsFromConfiguration {
|
||||
public abstract string Position { get; set; }
|
||||
}
|
||||
|
||||
public static class OptionsFromConfigurationExtensions {
|
||||
|
||||
public static T AddOptionsFromConfiguration<T>(this IServiceCollection services, IConfiguration configuration) where T : OptionsFromConfiguration {
|
||||
T optionsInstance = (T)Activator.CreateInstance(typeof(T));
|
||||
if (optionsInstance == null) return null;
|
||||
var position = optionsInstance.Position;
|
||||
|
||||
services.Configure((Action<T>)(options => {
|
||||
configuration.Bind(position, options);
|
||||
}));
|
||||
|
||||
return optionsInstance;
|
||||
}
|
||||
|
||||
}
|
||||
12
ProjectManager.Backend/Options/ProxyOptions.cs
Normal file
12
ProjectManager.Backend/Options/ProxyOptions.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace ProjectManager.Backend.Options;
|
||||
|
||||
public class ProxyOptions : OptionsFromConfiguration {
|
||||
public override string Position { get; set; } = "Proxy";
|
||||
|
||||
public bool Enable { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Domain { get; set; }
|
||||
public string Host { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user