Table of Contents

Class DeploymentSecretService

Namespace
FishMMO.Database.Npgsql.Services
Assembly
FishMMO-DB.dll

Service for managing deployment-global secrets loaded by servers at startup. Uses a compiled query for reads and a raw SQL upsert for writes.

public sealed class DeploymentSecretService : BaseService<DeploymentSecretEntity>, IDeploymentSecretService
Inheritance
DeploymentSecretService
Implements
Inherited Members

Constructors

DeploymentSecretService(INpgsqlDbContextFactory)

Initializes a new instance of DeploymentSecretService.

public DeploymentSecretService(INpgsqlDbContextFactory dbContextFactory)

Parameters

dbContextFactory INpgsqlDbContextFactory

DbContext factory for creating contexts.

Exceptions

ArgumentNullException

Thrown when dbContextFactory is null.

Methods

FetchAsync(string, CancellationToken)

Fetches a secret value by its key.

public Task<DatabaseResult<string>> FetchAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string

The logical key identifying the secret.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<DatabaseResult<string>>

A DatabaseResult<T> containing the secret value if found; otherwise a failure with ENTITY_NOT_FOUND.

UpsertAsync(string, string, CancellationToken)

Inserts or updates a deployment secret. On insert, a new row is created with the current timestamp. On update, the value and updated_at are refreshed.

public Task<DatabaseResult> UpsertAsync(string key, string value, CancellationToken cancellationToken = default)

Parameters

key string

The logical key identifying the secret.

value string

The secret value to store.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<DatabaseResult>

A DatabaseResult describing the outcome.