feat: makes sentry more configurable
This commit is contained in:
1
.env
1
.env
@@ -61,6 +61,7 @@ NTFY_DSN=
|
|||||||
|
|
||||||
###> sentry/sentry-symfony ###
|
###> sentry/sentry-symfony ###
|
||||||
SENTRY_DSN=
|
SENTRY_DSN=
|
||||||
|
SENTRY_JS_URL=
|
||||||
###< sentry/sentry-symfony ###
|
###< sentry/sentry-symfony ###
|
||||||
|
|
||||||
# TMDB 'with_original_language' option
|
# TMDB 'with_original_language' option
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ when@prod:
|
|||||||
|
|
||||||
options:
|
options:
|
||||||
release: '%app.version%'
|
release: '%app.version%'
|
||||||
traces_sample_rate: 0
|
traces_sample_rate: 1
|
||||||
profiles_sample_rate: 0
|
profiles_sample_rate: 1
|
||||||
attach_stacktrace: true
|
attach_stacktrace: true
|
||||||
|
|
||||||
# tracing:
|
tracing:
|
||||||
# enabled: true
|
enabled: true
|
||||||
# dbal: # DB queries
|
dbal: # DB queries
|
||||||
# enabled: true
|
enabled: true
|
||||||
# cache: # cache pools
|
cache: # cache pools
|
||||||
# enabled: true
|
enabled: true
|
||||||
# twig: # templating engine
|
twig: # templating engine
|
||||||
# enabled: true
|
enabled: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# (Optionally) Configure the breadcrumb handler as a service (needed for the breadcrumb Monolog handler)
|
# (Optionally) Configure the breadcrumb handler as a service (needed for the breadcrumb Monolog handler)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
twig:
|
twig:
|
||||||
globals:
|
globals:
|
||||||
version: '%app.version%'
|
version: '%app.version%'
|
||||||
|
sentry_javascript_url: '%sentry.javascript_url%'
|
||||||
file_name_pattern: '*.twig'
|
file_name_pattern: '*.twig'
|
||||||
date:
|
date:
|
||||||
format: 'm/d/Y'
|
format: 'm/d/Y'
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ parameters:
|
|||||||
notification.transport: '%env(NOTIFICATION_TRANSPORT)%'
|
notification.transport: '%env(NOTIFICATION_TRANSPORT)%'
|
||||||
notification.ntfy.dsn: '%env(NTFY_DSN)%'
|
notification.ntfy.dsn: '%env(NTFY_DSN)%'
|
||||||
|
|
||||||
|
# Sentry
|
||||||
|
sentry.dsn: '%env(SENTRY_DSN)%'
|
||||||
|
sentry.javascript_url: '%env(SENTRY_JS_URL)%'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
_defaults:
|
_defaults:
|
||||||
|
|||||||
@@ -53,6 +53,15 @@ final class ConfigResolver
|
|||||||
|
|
||||||
#[Autowire(param: 'notification.ntfy.dsn')]
|
#[Autowire(param: 'notification.ntfy.dsn')]
|
||||||
private ?string $notificationNtfyDsn = null,
|
private ?string $notificationNtfyDsn = null,
|
||||||
|
|
||||||
|
#[Autowire(param: 'sentry.dsn')]
|
||||||
|
private ?string $sentryDsn = null,
|
||||||
|
|
||||||
|
#[Autowire(param: 'sentry.environment')]
|
||||||
|
private ?string $sentryEnvironment = null,
|
||||||
|
|
||||||
|
#[Autowire(param: 'sentry.javascript_url')]
|
||||||
|
private ?string $sentryJavascriptUrl = null,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function validate(): bool
|
public function validate(): bool
|
||||||
@@ -120,4 +129,13 @@ final class ConfigResolver
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSentryConfig()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'dsn' => $this->sentryDsn,
|
||||||
|
'environment' => $this->sentryEnvironment,
|
||||||
|
'javascript_url' => $this->sentryJavascriptUrl,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,4 +112,12 @@ class UtilExtension
|
|||||||
|
|
||||||
return new EpisodeIdDto($season, $episode);
|
return new EpisodeIdDto($season, $episode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AsTwigFunction('sentry_enabled')]
|
||||||
|
public function sentryEnabled(): bool
|
||||||
|
{
|
||||||
|
$sentryConfig = $this->config->getSentryConfig();
|
||||||
|
return $sentryConfig['javascript_url'] !== null &&
|
||||||
|
$sentryConfig['javascript_url'] !== '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||||
|
<script src="https://bugs.caldwell.digital/js-sdk-loader/8dddf7fb26fbec602ad212173a942450.min.js" crossorigin="anonymous"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-cyan-950 flex flex-col h-full">
|
<body class="bg-cyan-950 flex flex-col h-full">
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||||
|
|
||||||
|
{% if sentry_enabled() %}
|
||||||
|
<script src="{{ sentry_javascript_url }}" crossorigin="anonymous"></script>
|
||||||
|
{% endif %}
|
||||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user