Skip to content

Fixed namespace provisioning #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Synapse.Api.Application.Services;
/// <param name="yamlSerializer">The service used to serialize/deserialize data to/from YAML</param>
/// <param name="workflowDefinitionReader">The service used to read <see cref="WorkflowDefinition"/>s</param>
/// <param name="options">The service used to access the current <see cref="ApiServerOptions"/></param>
public class WorkflowDatabaseInitializer(IServiceProvider serviceProvider, ILogger<WorkflowDatabaseInitializer> logger, IJsonSerializer jsonSerializer, IYamlSerializer yamlSerializer, IWorkflowDefinitionReader workflowDefinitionReader, IOptions<ApiServerOptions> options)
public class DatabaseProvisioner(IServiceProvider serviceProvider, ILogger<DatabaseProvisioner> logger, IJsonSerializer jsonSerializer, IYamlSerializer yamlSerializer, IWorkflowDefinitionReader workflowDefinitionReader, IOptions<ApiServerOptions> options)
: IHostedService
{

Expand Down Expand Up @@ -132,7 +132,7 @@ protected virtual async Task ProvisionNamespacesAsync(IResourceRepository resour
using var stream = file.OpenRead();
using var streamReader = new StreamReader(stream);
var text = await streamReader.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
var ns = serializer.Deserialize<NamespaceDefinition>(text)!;
var ns = serializer.Deserialize<Namespace>(text)!;
await resources.AddAsync(ns, false, cancellationToken).ConfigureAwait(false);
this.Logger.LogInformation("Successfully imported namespace '{namespace}' from file '{file}'", $"{ns.Metadata.Name}", file.FullName);
count++;
Expand Down
2 changes: 1 addition & 1 deletion src/api/Synapse.Api.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
builder.Services.AddSynapse(builder.Configuration);
builder.Services.AddSynapseApi();
builder.Services.AddSynapseHttpApi(authority);
builder.Services.AddHostedService<WorkflowDatabaseInitializer>();
builder.Services.AddHostedService<DatabaseProvisioner>();

var authentication = builder.Services.AddAuthentication(FallbackPolicySchemeDefaults.AuthenticationScheme);
authentication.AddScheme<StaticBearerAuthenticationOptions, StaticBearerAuthenticationHandler>(StaticBearerDefaults.AuthenticationScheme, options =>
Expand Down