Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Sentry DSN as secret setting #182

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion edge-apps/tfl-bus-status/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h3 class="bus-arrival"></h3>
</div>
</div>
<script src="screenly.js?version=1"></script>
<script src="https://browser.sentry-cdn.com/8.30.0/bundle.tracing.min.js" integrity="sha384-whi3vRW+DIBqY2lQQ6oghGXbbA0sL5NJxUL6CMC+LRJ0b4A64Qn7/6YhpeR0+3Nq" crossorigin="anonymous"></script>
<script src="static/js/script.js"></script>
<script src="https://js.sentry-cdn.com/f68a4f224d3e72a6ae347025c1d410dd.min.js" crossorigin="anonymous"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions edge-apps/tfl-bus-status/screenly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ settings:
help_text: |
You can find your bus stop here:
https://playground.srly.io/edge-apps/helpers/tfl/bus-stop-lookup/
sentry_dsn:
type: secret
title: Sentry Client Key
optional: true
is_global: true
help_text: Sentry Client Key from Sentry SDK for error capturing.
13 changes: 11 additions & 2 deletions edge-apps/tfl-bus-status/static/js/script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/* global screenly */
/* global screenly, Sentry */

const apiUrl = 'https://api.tfl.gov.uk/' // Base URL for the TfL API
const stopId = screenly.settings.stop_id
const apiKey = screenly.settings.tfl_api_token
const sentryDsn = screenly.settings.sentry_dsn

// Initiate Sentry.
if (sentryDsn) {
Sentry.init({
dsn: sentryDsn
})
} else {
console.warn('Sentry DSN is not defined. Sentry will not be initialized.')
}

async function getCachedData (url, cacheKey) {
const cachedData = JSON.parse(localStorage.getItem(cacheKey))
Expand Down Expand Up @@ -227,7 +237,6 @@ async function fetchBusData () {
busArrival.innerHTML = error
document.querySelector('.bus-list').classList.add('hidden')
}
// Send signal to load the screen once content is ready.
screenly.signalReadyForRendering()
}

Expand Down
Loading