feat(headless): share immutable process content
This commit is contained in:
parent
fbdb58a962
commit
12b500d383
11 changed files with 617 additions and 18 deletions
|
|
@ -16,6 +16,17 @@ internal sealed class HeadlessConfiguration
|
|||
internal sealed class HeadlessProcessSettings
|
||||
{
|
||||
public HeadlessPathOverrides Paths { get; init; } = new();
|
||||
|
||||
public HeadlessContentDescriptor? Content { get; init; }
|
||||
}
|
||||
|
||||
internal sealed class HeadlessContentDescriptor
|
||||
{
|
||||
[JsonRequired]
|
||||
public string DatDirectory { get; init; } = string.Empty;
|
||||
|
||||
[JsonRequired]
|
||||
public string PreparedAssetPath { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
internal sealed class HeadlessSessionDescriptor
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ internal static class HeadlessConfigurationLoader
|
|||
"sessions must be an array.");
|
||||
}
|
||||
|
||||
ValidateContent(configuration.Process?.Content);
|
||||
|
||||
var sessionIds = new HashSet<string>(StringComparer.Ordinal);
|
||||
var credentialReferences = new HashSet<string>(
|
||||
StringComparer.Ordinal);
|
||||
|
|
@ -83,6 +85,18 @@ internal static class HeadlessConfigurationLoader
|
|||
return configuration;
|
||||
}
|
||||
|
||||
private static void ValidateContent(HeadlessContentDescriptor? content)
|
||||
{
|
||||
if (content is null)
|
||||
return;
|
||||
if (string.IsNullOrWhiteSpace(content.DatDirectory)
|
||||
|| string.IsNullOrWhiteSpace(content.PreparedAssetPath))
|
||||
{
|
||||
throw new HeadlessConfigurationException(
|
||||
"process.content requires non-empty datDirectory and preparedAssetPath.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateSession(HeadlessSessionDescriptor session)
|
||||
{
|
||||
if (session.Endpoint is null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue