Files
Khaemhat/src/Khaemhat.Web/Program.cs
T
Alby96andClaude Opus 5.5 9bcf8c1082 feat: company table screens, profile and fiscal years, seed command (#38, #39, #45)
Gives the company tables of the previous commit their screens, so a company
can be configured from the browser, and makes the base data runnable outside
the web server.

- one generic editor for the 26 coded tables (/tabelle/<slug>), described in
  TableScreens: grid with active/disabled filter, detail with errors and
  warnings, disable instead of delete, CSV export and all-or-nothing import,
  "update from base tables"; index page and menu entries
- company profile in tabs with the fiscal pack checks, fiscal years with
  month lock/unlock, exchange rates with manual rates
- PaymentTermService: installments saved together, percentages must sum to 100
- a new profile proposes the registered company name instead of its code
- seed verb in Khaemhat.Web and scripts/seed.sh --base [--company CODE],
  shipped in the image under /app/scripts
- ADR 0026 (base data only adds missing codes; ISTAT and ABI/CAB lists come
  as separate datasets), wiki, CHANGELOG, STATUS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:15:09 +01:00

34 lines
1.1 KiB
C#

using Khaemhat.Application.Configuration;
using Khaemhat.Web.Hosting;
try
{
// scripts/seed.sh: the base data from the command line, without serving anything.
if (SeedCommand.Matches(args))
{
return await SeedCommand.RunAsync(args).ConfigureAwait(false);
}
await KhaemhatApp.Build(args).RunAsync().ConfigureAwait(false);
}
catch (ConfigurationException ex)
{
// A missing or wrong variable: every problem on stderr, no value printed, exit code 2 (SPEC §6).
await Console.Error.WriteLineAsync("Khaemhat cannot start, the configuration is not valid:").ConfigureAwait(false);
foreach (var error in ex.Errors)
{
await Console.Error.WriteLineAsync(" - " + error).ConfigureAwait(false);
}
return 2;
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
// The start failed after the configuration was read (system database unreachable, migration refused): the log
// already has the details; the container restart policy decides what happens next.
await Console.Error.WriteLineAsync("Khaemhat stopped: " + ex.Message).ConfigureAwait(false);
return 1;
}
return Environment.ExitCode;