1- import { env } from '$env/dynamic/private' ;
1+ import {
2+ NOTIFICATION_TRIGGER_PORT ,
3+ NOTIFICATION_TRIGGER_URL ,
4+ PROVISIONER_URL ,
5+ PUBLIC_PROVISIONER_URL
6+ } from '$env/static/private' ;
27
38export interface NotificationPayload {
49 title : string ;
@@ -22,9 +27,9 @@ export interface SendResult {
2227}
2328
2429function getBaseUrl ( ) : string {
25- const url = env . NOTIFICATION_TRIGGER_URL ;
30+ const url = NOTIFICATION_TRIGGER_URL ;
2631 if ( url ) return url ;
27- const port = env . NOTIFICATION_TRIGGER_PORT || '3998' ;
32+ const port = NOTIFICATION_TRIGGER_PORT || '3998' ;
2833 return `http://localhost:${ port } ` ;
2934}
3035
@@ -49,9 +54,7 @@ export async function sendNotification(request: SendNotificationRequest): Promis
4954}
5055
5156export async function getDevicesWithTokens ( ) : Promise < { token : string ; eName : string } [ ] > {
52- const { env } = await import ( '$env/dynamic/private' ) ;
53- const provisionerUrl =
54- env . PUBLIC_PROVISIONER_URL || env . PROVISIONER_URL || 'http://localhost:3001' ;
57+ const provisionerUrl = PUBLIC_PROVISIONER_URL || PROVISIONER_URL || 'http://localhost:3001' ;
5558 try {
5659 const response = await fetch ( `${ provisionerUrl } /api/devices/list` , {
5760 signal : AbortSignal . timeout ( 10000 )
@@ -68,9 +71,7 @@ export async function getDevicesWithTokens(): Promise<{ token: string; eName: st
6871export async function getDevicesByEName (
6972 eName : string
7073) : Promise < { token : string ; eName : string } [ ] > {
71- const { env } = await import ( '$env/dynamic/private' ) ;
72- const provisionerUrl =
73- env . PUBLIC_PROVISIONER_URL || env . PROVISIONER_URL || 'http://localhost:3001' ;
74+ const provisionerUrl = PUBLIC_PROVISIONER_URL || PROVISIONER_URL || 'http://localhost:3001' ;
7475 try {
7576 const response = await fetch (
7677 `${ provisionerUrl } /api/devices/by-ename/${ encodeURIComponent ( eName ) } ` ,
0 commit comments