|
|
@ -1,49 +1,14 @@
|
|
|
|
namespace Connected.Host.Configuration
|
|
|
|
namespace Connected.Host.Configuration;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal class SysConfiguration
|
|
|
|
{
|
|
|
|
{
|
|
|
|
internal static class SysConfiguration
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
private const string DefaultStart = "Connected.Instance.Start, Connected.Instance";
|
|
|
|
private const string DefaultStart = "Connected.Instance.Start, Connected.Instance";
|
|
|
|
|
|
|
|
|
|
|
|
private static List<MicroServiceDescriptor> _microServices;
|
|
|
|
private string _start = DefaultStart;
|
|
|
|
private static List<string> _locations;
|
|
|
|
|
|
|
|
private static string _start;
|
|
|
|
|
|
|
|
public static List<MicroServiceDescriptor> MicroServices => _microServices;
|
|
|
|
|
|
|
|
public static List<string> Locations => _locations;
|
|
|
|
|
|
|
|
public static string Start => _start;
|
|
|
|
|
|
|
|
public static void Build()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var cb = new ConfigurationBuilder();
|
|
|
|
|
|
|
|
var appPath = AppContext.BaseDirectory;
|
|
|
|
|
|
|
|
var segments = new Uri(appPath).Segments;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
segments = segments.Select(e => e.Replace("%20", " ")).ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 1; i <= segments.Length; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var pathBase = Path.Combine(segments[0..i]);
|
|
|
|
|
|
|
|
var filePath = Path.Combine(pathBase, "sys.json");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (File.Exists(filePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cb.AddJsonFile(filePath, true, false);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb.AddEnvironmentVariables();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var config = cb.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_microServices = new List<MicroServiceDescriptor>();
|
|
|
|
|
|
|
|
_locations = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.Bind("microServices", _microServices);
|
|
|
|
public List<MicroServiceDescriptor> MicroServices { get; set; } = new();
|
|
|
|
config.Bind("locations", _locations);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_start = config["start"];
|
|
|
|
public List<string> Repositories { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_start))
|
|
|
|
public string Start { get => _start ?? DefaultStart; set => _start = value; }
|
|
|
|
_start = DefaultStart;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|