|
| 1 | +namespace Resgrid.Config |
| 2 | +{ |
| 3 | + public static class WorkflowConfig |
| 4 | + { |
| 5 | + |
| 6 | + /// <summary>Default maximum number of retry attempts for a failed workflow action execution.</summary> |
| 7 | + public static int DefaultMaxRetryCount = 3; |
| 8 | + |
| 9 | + /// <summary>Hard ceiling on MaxRetryCount a user may configure — prevents infinite retry abuse.</summary> |
| 10 | + public static int MaxAllowedRetryCount = 5; |
| 11 | + |
| 12 | + /// <summary>Base seconds for exponential back-off: delay = RetryBackoffBaseSeconds * 2^(attempt-1)</summary> |
| 13 | + public static int RetryBackoffBaseSeconds = 5; |
| 14 | + |
| 15 | + /// <summary>Maximum concurrent workflow executions processed by a single worker instance.</summary> |
| 16 | + public static int MaxConcurrentWorkflows = 5; |
| 17 | + |
| 18 | + // ── Rate Limiting ──────────────────────────────────────────────────────────── |
| 19 | + |
| 20 | + /// <summary>Maximum workflow enqueue operations allowed per department per minute (paid plans).</summary> |
| 21 | + public static int RateLimitPerDepartmentPerMinute = 60; |
| 22 | + |
| 23 | + /// <summary>Aggressive rate limit for free-plan departments — cannot be bypassed by exempt event types.</summary> |
| 24 | + public static int FreePlanRateLimitPerDepartmentPerMinute = 5; |
| 25 | + |
| 26 | + /// <summary>Maximum workflow runs a free-plan department may enqueue in a single calendar day (UTC).</summary> |
| 27 | + public static int FreePlanDailyRunLimit = 50; |
| 28 | + |
| 29 | + // ── Workflow and Step Caps ─────────────────────────────────────────────────── |
| 30 | + |
| 31 | + /// <summary>Maximum number of workflows a paid-plan department may create.</summary> |
| 32 | + public static int MaxWorkflowsPerDepartment = 28; |
| 33 | + |
| 34 | + /// <summary>Maximum number of steps per workflow for paid-plan departments.</summary> |
| 35 | + public static int MaxStepsPerWorkflow = 20; |
| 36 | + |
| 37 | + /// <summary>Maximum number of workflows a free-plan department may create.</summary> |
| 38 | + public static int FreeMaxWorkflowsPerDepartment = 3; |
| 39 | + |
| 40 | + /// <summary>Maximum number of steps per workflow for free-plan departments.</summary> |
| 41 | + public static int FreeMaxStepsPerWorkflow = 5; |
| 42 | + |
| 43 | + // ── Per-Action Daily Send Limits ───────────────────────────────────────────── |
| 44 | + |
| 45 | + /// <summary>Maximum emails a department may send per workflow step per day (paid plans).</summary> |
| 46 | + public static int MaxDailyEmailSendsPerDepartment = 500; |
| 47 | + |
| 48 | + /// <summary>Maximum SMS messages a department may send per workflow step per day (paid plans).</summary> |
| 49 | + public static int MaxDailySmsPerDepartment = 200; |
| 50 | + |
| 51 | + /// <summary>Maximum emails a free-plan department may send via workflows per day.</summary> |
| 52 | + public static int FreeMaxDailyEmailSendsPerDepartment = 10; |
| 53 | + |
| 54 | + /// <summary>Maximum SMS messages a free-plan department may send via workflows per day.</summary> |
| 55 | + public static int FreeMaxDailySmsPerDepartment = 5; |
| 56 | + |
| 57 | + // ── Recipient Caps ─────────────────────────────────────────────────────────── |
| 58 | + |
| 59 | + /// <summary>Maximum email recipients (To + Cc combined) for paid-plan workflow steps.</summary> |
| 60 | + public static int MaxEmailRecipients = 10; |
| 61 | + |
| 62 | + /// <summary>Maximum SMS recipients for paid-plan workflow steps.</summary> |
| 63 | + public static int MaxSmsRecipients = 5; |
| 64 | + |
| 65 | + // ── Template Size Limits ───────────────────────────────────────────────────── |
| 66 | + |
| 67 | + /// <summary>Maximum length in characters for an OutputTemplate stored on a WorkflowStep (64 KB).</summary> |
| 68 | + public static int MaxOutputTemplateLength = 65536; |
| 69 | + |
| 70 | + /// <summary>Maximum length in characters of rendered template content passed to an executor (256 KB).</summary> |
| 71 | + public static int MaxRenderedContentLength = 262144; |
| 72 | + |
| 73 | + // ── Scriban Sandbox Limits ─────────────────────────────────────────────────── |
| 74 | + |
| 75 | + /// <summary>Maximum number of loop iterations in a Scriban template.</summary> |
| 76 | + public static int ScribanLoopLimit = 500; |
| 77 | + |
| 78 | + /// <summary>Maximum recursion depth in a Scriban template.</summary> |
| 79 | + public static int ScribanRecursionLimit = 50; |
| 80 | + } |
| 81 | +} |
| 82 | + |
0 commit comments