-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmain.ts
More file actions
87 lines (74 loc) · 2.5 KB
/
Copy pathmain.ts
File metadata and controls
87 lines (74 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// init app
import App from '@/App.vue';
import { createApp } from 'vue';
import { apiUrlKey, shortUrlKey } from '@/keys';
import { defaultLocale } from '@/utils';
// pinia state management
import { createPinia } from 'pinia';
// init router
import router from '@/router';
// init composables
import useDayJS from '@/composables/dayjs';
import i18ninstance from '@/composables/i18n';
// init basic css with services-ui styles
import '@/assets/styles/main.css';
import '@thunderbirdops/services-ui/style.css';
// init sentry
import * as Sentry from '@sentry/vue';
const app = createApp(App);
const useSentry = !!import.meta.env.VITE_SENTRY_DSN;
// The modes we use -> short names for sorting
const environmentMap = {
// Development is used by vite in dev mode...
development: 'dev',
// We set these correctly :)
stage: 'stage',
prod: 'prod',
};
const environment = environmentMap[import.meta.env.MODE] ?? 'unknown';
if (useSentry) {
Sentry.init({
app,
environment,
dsn: import.meta.env.VITE_SENTRY_DSN,
integrations: [
Sentry.browserTracingIntegration({
router,
}),
Sentry.replayIntegration(),
],
// Performance Monitoring
// Capture 100% of the transactions, reduce in production!
tracesSampleRate: 1.0,
// Session Replay
// This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a
// lower rate in production.
replaysSessionSampleRate: 0.1,
// If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where
// errors occur.
replaysOnErrorSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: [
'localhost',
'https://stage.appointment.day',
'https://appointment-stage.tb.pro',
'https://appointment.tb.pro',
'https://apmt.day',
'https://apt.mt',
],
sendDefaultPii: false,
});
}
const pinia = createPinia();
app.use(pinia);
app.use(router);
// init urls
const protocol = import.meta.env.VITE_API_SECURE === 'true' ? 'https' : 'http';
const port = import.meta.env.VITE_API_PORT !== undefined ? `:${import.meta.env.VITE_API_PORT}` : '';
const apiUrl = `${protocol}://${import.meta.env.VITE_API_URL}${port}`;
app.provide(apiUrlKey, apiUrl);
app.provide(shortUrlKey, `${protocol}://${import.meta.env.VITE_SHORT_BASE_URL}`);
app.use(i18ninstance);
useDayJS(app, defaultLocale());
// ready? let's go!
app.mount('#app');