Skip to content

Configuration ​

GrydReports configuration is split into:

  • GrydReportsOptions (main module behavior)
  • GrydFiles:Profiles:gryd.report (where generated files are stored — see File Storage)
  • ReportDeliveryOptions (delivery defaults)
  • ReportScheduleOptions (recurring scheduling guardrails)

Use the facade for the standard stack (Application + Infrastructure + API):

csharp
builder.Services.AddGrydReports(
    builder.Configuration,
    db => db.UseNpgsql(builder.Configuration.GetConnectionString("GrydReports"))
);

This automatically binds GrydReportsOptions from GrydReports section in appsettings.json.

Advanced Setup (Fine-Grained) ​

Use Infrastructure registration directly when you need explicit option callbacks:

csharp
builder.Services.AddGrydReportsApplication();
builder.Services.AddGrydReportsInfrastructure(
    configureOptions: options =>
    {
        options.AutoRegisterTemplates = true;
        options.TemplateAssemblies.Add(typeof(Program).Assembly);
    },
    configureDbContext: db =>
        db.UseNpgsql(builder.Configuration.GetConnectionString("GrydReports"))
);
builder.Services.AddGrydReportsApi();

appsettings.json ​

GrydReports section is bound to GrydReportsOptions. The optional scheduling integration uses the GrydJobs module's connection key, ConnectionStrings:GrydJobs; it is configured by GrydJobs, not by GrydReports.

json
{
  "ConnectionStrings": {
    "GrydReports": "Host=localhost;Database=gryd_reports;Username=postgres;Password=postgres",
    "GrydJobs": "Host=localhost;Port=5432;Database=gryd_jobs;Username=postgres;Password=postgres"
  },
  "GrydReports": {
    "AutoRegisterTemplates": true
  },
  "GrydFiles": {
    "Profiles": {
      "gryd.report": {
        "MaxSizeBytes": 52428800,
        "AllowedContentTypes": [
          "application/pdf",
          "text/csv",
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        ],
        "ScanRequired": false,
        "DefaultRetentionMode": "UntilReleased"
      }
    }
  }
}

File Storage (GrydFiles) ​

Generated reports are stored in GrydFiles, the platform's file module, in process. There is no report-specific storage configuration: the bucket is the one GrydStorage configures, and the rules come from the gryd.report profile. The host registers the file module; GrydReports refuses to start when the gryd.report profile is not declared.

csharp
builder.Services.AddGrydObjectStorage(builder.Configuration);
builder.Services.AddGrydFiles(builder.Configuration);
builder.Services.AddGrydFilesClamAv(builder.Configuration);
builder.Services.AddGrydReports(builder.Configuration, db => db.UseNpgsql(connectionString));
gryd.report settingMeaning for reports
AllowedContentTypesMust include the type of every format you render: application/pdf, text/csv, the XLSX type. A report of a format the profile does not accept fails to store
MaxSizeBytesThe largest report that can be stored
ScanRequired: falseThe antivirus is waived — the file never left this process. The server still computes the SHA-256 and checks the content against the type, and the waiver is written to the audit trail at start-up
DefaultRetentionMode: UntilReleasedThe file lives while its execution holds it. Deleting the execution releases it, and GrydFiles purges it after GrydFiles:PurgeGracePeriodDays
DownloadUrlTtlMinutesHow long a download URL from GET /reports/{id}/download stays valid (default 5)

Each stored report is referenced by its execution with owner scope gryd.report-execution and owner key equal to the execution id. See the GrydFiles pages on retention and purge and download.

Delivery Configuration ​

Configure default delivery constraints and message templates:

csharp
builder.Services.ConfigureGrydReportsDelivery(opts =>
{
    opts.DefaultSenderEmail = "reports@company.com";
    opts.DefaultSenderName = "Report System";
    opts.DefaultEmailSubject = "Report: {ReportName} - {Date}";
    opts.DefaultEmailBody = "Please find the attached report.";
    opts.MaxRecipients = 50;
    opts.WebhookTimeout = TimeSpan.FromSeconds(30);
    opts.RetryCount = 3;
});

The built-in email placeholder uses the recipient limit and email subject/body defaults only to validate and log intent; it has no SMTP sender. A host provider owns its transport settings. RetryCount is currently not consumed by the shipped webhook provider and does not enable retries.

Scheduling Configuration (Optional) ​

ReportScheduleOptions is currently registered as a configuration type but its properties are not consumed by the scheduling runtime. Setting these values does not enforce the listed limits. Recurring scheduling itself is optional and only applies when:

  • GrydReports.Scheduling.GrydJobs package is installed
  • builder.Services.AddGrydReportsScheduling() is registered
csharp
builder.Services.ConfigureGrydReportsScheduling(opts =>
{
    // 0 = unlimited schedules per tenant
    opts.MaxSchedulesPerTenant = 0;

    opts.MaxConsecutiveFailures = 3;
    opts.MinimumInterval = TimeSpan.FromHours(1);
    opts.NotifyOnAutoPause = true;
});

Declared options without runtime behavior ​

These configuration properties exist in the options model, but current runtime code does not consume them. Setting them does not enable the described behavior:

  • GlobalReports does not bypass tenant query filters.
  • Permissions does not enforce per-template authorization; apply policies in the host.
  • DigitalSignature does not cryptographically sign generated PDFs. The QuestPDF signature component draws a visible signature line only.
  • Caching does not cache report output.
  • ConnectionString is not used to configure the Reports DbContext; configure the database provider via the facade's configureDbContext argument or Infrastructure registration.
  • EmailDelivery is not read by the delivery providers; use ReportDeliveryOptions for the built-in email placeholder's validation/logging defaults or supply a host IReportDelivery provider.
  • RetentionDays, EnableAutoCleanup, MaxSyncGenerationSize, SyncGenerationTimeout, and ForceAsyncAboveBytes do not currently alter the generation or cleanup path.
  • ReportScheduleOptions properties are declarations only; recurring job registration does not consume those limits or notification settings.

The GrydReportsOptions source and ReportScheduleOptions source show the declared shapes. Use the registration examples above for settings that the current runtime actually reads.

Health Checks ​

Register module health checks:

csharp
builder.Services.AddGrydReportsHealthChecks(builder.Configuration);

This registers:

  • grydreports-database: PostgreSQL connectivity
  • grydreports-self: module self-check

Map endpoint:

csharp
app.MapHealthChecks("/health", new HealthCheckOptions
{
    Predicate = check => check.Tags.Contains("grydreports")
});

Option Reference ​

GrydReportsOptions ​

OptionTypeDefaultDescription
ConnectionStringstring?nullNot used to configure the DbContext; configure its provider through registration
RetentionDaysint90Declared option; current cleanup does not read it
EnableAutoCleanupbooltrueDeclared option; current cleanup does not read it
MaxSyncGenerationSizelong50 MBDeclared option; generation does not enforce this limit
SyncGenerationTimeoutTimeSpan2 minDeclared option; generation does not enforce this timeout
ForceAsyncAboveByteslong?nullReserved; currently unused and does not enable queued generation
AutoRegisterTemplatesbooltrueScans only assemblies supplied through TemplateAssemblies
Caching.EnabledboolfalseReserved property; generation does not read it or cache output
Caching.DefaultExpirationTimeSpan1 hourReserved property; no cache TTL is applied
DigitalSignature.EnabledboolfalseDeclared option; no PDF signing implementation consumes it

ReportDeliveryOptions ​

OptionTypeDefaultDescription
DefaultSenderEmailstring?nullDefault sender email
DefaultSenderNamestring?nullDefault sender display name
DefaultEmailSubjectstringReport: {ReportName} - {Date}Subject template
DefaultEmailBodystringPlease find the attached report.Body template
MaxRecipientsint50Max email recipients
WebhookTimeoutTimeSpan30sWebhook timeout
RetryCountint3Reserved declaration; the shipped webhook provider does not retry automatically

ReportScheduleOptions (optional scheduling; declarations are not consumed) ​

OptionTypeDefaultDescription
MaxSchedulesPerTenantint0Declared option; no active-schedule limit is enforced from this setting
MaxConsecutiveFailuresint3Declared option; not applied to schedule execution
MinimumIntervalTimeSpan1 hourDeclared option; no minimum interval is enforced from this setting
NotifyOnAutoPausebooltrueDeclared option; no notification is sent from this setting

Released under the MIT License.