diff --git a/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/EformWorkflowPlugin.cs b/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/EformWorkflowPlugin.cs index 2ec7d43..c2b19c5 100644 --- a/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/EformWorkflowPlugin.cs +++ b/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/EformWorkflowPlugin.cs @@ -100,28 +100,38 @@ public void ConfigureOptionsServices(IServiceCollection services, IConfiguration configuration.GetSection("WorkflowBaseSettings")); } + // Declared once, as in the csproj: the API host reads the + // same assembly metadata to route this plugin's events to its own Sentry project. + private static string SentryDsn => + typeof(EformWorkflowPlugin).Assembly + .GetCustomAttributes() + .FirstOrDefault(x => x.Key == "SentryDsn")?.Value; + public void ConfigureDbContext(IServiceCollection services, string connectionString) { - SentrySdk.Init(options => + if (!string.IsNullOrWhiteSpace(SentryDsn)) { - // A Sentry Data Source Name (DSN) is required. - // See https://docs.sentry.io/product/sentry-basics/dsn-explainer/ - // You can set it in the SENTRY_DSN environment variable, or you can set it in code here. - options.Dsn = "https://80b935299e69fe24c21043140b62f2ab@o4506241219428352.ingest.us.sentry.io/4508266849501184"; - - // When debug is enabled, the Sentry client will emit detailed debugging information to the console. - // This might be helpful, or might interfere with the normal operation of your application. - // We enable it here for demonstration purposes when first trying Sentry. - // You shouldn't do this in your applications unless you're troubleshooting issues with Sentry. - options.Debug = false; - - // This option is recommended. It enables Sentry's "Release Health" feature. - options.AutoSessionTracking = true; - - // This option is recommended for client applications only. It ensures all threads use the same global scope. - // If you're writing a background service of any kind, you should remove this. - options.IsGlobalModeEnabled = true; - }); + SentrySdk.Init(options => + { + // A Sentry Data Source Name (DSN) is required. + // See https://docs.sentry.io/product/sentry-basics/dsn-explainer/ + // You can set it in the SENTRY_DSN environment variable, or you can set it in code here. + options.Dsn = SentryDsn; + + // When debug is enabled, the Sentry client will emit detailed debugging information to the console. + // This might be helpful, or might interfere with the normal operation of your application. + // We enable it here for demonstration purposes when first trying Sentry. + // You shouldn't do this in your applications unless you're troubleshooting issues with Sentry. + options.Debug = false; + + // This option is recommended. It enables Sentry's "Release Health" feature. + options.AutoSessionTracking = true; + + // This option is recommended for client applications only. It ensures all threads use the same global scope. + // If you're writing a background service of any kind, you should remove this. + options.IsGlobalModeEnabled = true; + }); + } var pattern = @"Database=(\d+)_eform-angular-workflow-plugin;"; var match = Regex.Match(connectionString!, pattern); diff --git a/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Workflow.Pn.csproj b/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Workflow.Pn.csproj index 4754f6a..77d1456 100644 --- a/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Workflow.Pn.csproj +++ b/eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Workflow.Pn.csproj @@ -17,6 +17,10 @@ true + + + +