Archived
Private
Public Access
1
0
This commit is contained in:
2022-12-18 13:30:02 +01:00
commit 0e94ffa3c6
85 changed files with 26673 additions and 0 deletions

View 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; }
}

View 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;
}
}

View 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; }
}