Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/api/Program.cs
diff options
context:
space:
mode:
authorLeitwolf2026-10-29 16:34:29 +0300
committerGitHub2026-10-29 16:34:29 +0300
commit6b4e5e403875d3648be383395f1dad50f0d6503d (patch)
tree673620dce10f2723d8badf68b3b30de19ad8e6e0 /apps/api/Program.cs
parent0c0bbeab246a94035b572ce47d3502de997ac58a (diff)
parent3749e30da561652a226017d9360b84e34a8b74fc (diff)
downloadprogmaweb-6b4e5e403875d3648be383395f1dad50f0d6503d.tar.gz
Merge pull request #50 from Progmasoft/feature/provision-reserved-accounts
Provision the reserved accounts on the server
Diffstat (limited to 'apps/api/Program.cs')
-rw-r--r--apps/api/Program.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/api/Program.cs b/apps/api/Program.cs
index 873c120..6208b30 100644
--- a/apps/api/Program.cs
+++ b/apps/api/Program.cs
@@ -13,8 +13,10 @@ using Progmasoft.Progmaweb.Api.ViGet;
// `viget ...` runs a command of ViGet with the configuration of the service instead of the service itself; its
// arguments are not configuration.
+// `accounts ...` provisions a reserved account the same way.
bool vigetCommand = ViGetCommand.IsCommand(args);
-WebApplicationBuilder builder = WebApplication.CreateBuilder(vigetCommand ? [] : args);
+bool accountCommand = args is ["accounts", ..];
+WebApplicationBuilder builder = WebApplication.CreateBuilder(vigetCommand || accountCommand ? [] : args);
builder.Services.Configure<AccountSessionOptions>(builder.Configuration.GetSection(AccountSessionOptions.SectionName));
builder.Services.AddSingleton(TimeProvider.System);
@@ -109,6 +111,13 @@ builder.WebHost.ConfigureKestrel(options => options.Limits.MaxRequestBodySize =
WebApplication app = builder.Build();
+if (accountCommand)
+{
+ Environment.ExitCode = await AccountCommand.RunAsync(
+ app.Services, args[1..], new ConsolePasswordInput(), Console.Out, Console.Error, CancellationToken.None);
+ return;
+}
+
if (vigetCommand)
{
Environment.ExitCode = await ViGetCommand.RunAsync(