Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
using Febe.App;
|
|
using Febe.Core.Library;
|
|
using Febe.Web.Connection;
|
|
|
|
namespace Febe.Server;
|
|
|
|
/// <summary>
|
|
/// The checks made before anything starts (spec §8.2, §11): the interface password and the Data folder. With a problem
|
|
/// the engine and the browser do not start, and the interface shows only the page that explains it.
|
|
/// </summary>
|
|
internal static class StartupChecks
|
|
{
|
|
public const string PasswordMissing = "password-mancante";
|
|
|
|
public const string DataNotWritable = DataFolderProblems.DataNotWritable;
|
|
|
|
public const string DataOnNetwork = DataFolderProblems.DataOnNetwork;
|
|
|
|
/// <summary>Every problem found, in the order the error page shows them.</summary>
|
|
public static IReadOnlyList<ConfigurationProblem> Run(ServerOptions options, DataFolderCheck? check = null)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(options);
|
|
var problems = new List<ConfigurationProblem>();
|
|
if (string.IsNullOrEmpty(options.Password))
|
|
{
|
|
problems.Add(new ConfigurationProblem(
|
|
PasswordMissing,
|
|
"Manca la password dell'interfaccia",
|
|
"Il contenitore è partito senza la variabile FEBE_PASSWORD. Senza password l'interfaccia, e con lei la vista "
|
|
+ "remota del browser, sarebbe aperta a chiunque raggiunga il server: per questo Febe non ha avviato né il motore né il browser.",
|
|
"Imposta FEBE_PASSWORD (nel modello di Unraid o in compose.yml) con una frase lunga che usi solo qui, poi riavvia il contenitore."));
|
|
}
|
|
|
|
if (DataFolderProblems.Check(options.DataFolder, check) is { } data)
|
|
{
|
|
problems.Add(data);
|
|
}
|
|
|
|
return problems;
|
|
}
|
|
}
|