Skip to content

Commit

Permalink
Fix vapid key missing in test-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis960 committed Sep 10, 2024
1 parent 43e66be commit acbe7d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.playwright.server.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
GOOGLE_CLIENT_ID: DOES_NOT_MATTER
GOOGLE_CLIENT_SECRET: DOES_NOT_MATTER
PUBLIC_BASE_URL: http://localhost:4173
PUBLIC_MODE: DOES_NOT_MATTER
PUBLIC_MODE: test-ci
working-directory: Server
run: npm run test:integration

Expand Down
14 changes: 9 additions & 5 deletions Server/src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import cron from 'node-cron';
import webpush from 'web-push';

await migrate(db, { migrationsFolder: 'migrations' });
let privateVapidKey = privateEnv.PRIVATE_VAPID_KEY;
let publicVapidKey = publicEnv.PUBLIC_VAPID_KEY;

webpush.setVapidDetails(
'mailto:' + privateEnv.VAPID_EMAIL,
publicEnv.PUBLIC_VAPID_KEY,
privateEnv.PRIVATE_VAPID_KEY
);
if (publicEnv.PUBLIC_MODE === 'test-ci') {
const newKey = webpush.generateVAPIDKeys();
privateVapidKey = newKey.privateKey;
publicVapidKey = newKey.publicKey;
}

webpush.setVapidDetails('mailto:' + privateEnv.VAPID_EMAIL, publicVapidKey, privateVapidKey);

// send notifications every day at 8, 12, 16 and 20
cron.schedule('0 8,12,16,20 * * *', async () => {
Expand Down
9 changes: 0 additions & 9 deletions Server/src/lib/server/entities/SensorReadingEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ export const espSensorReadingSchema = z.object({

export type ESPSensorReadingDTO = z.infer<typeof espSensorReadingSchema>;

export interface LegacyESPSensorReadingDTO {
sensorAddress: number;
plantName: string;
water: number;
duration: number;
measurementDuration: number;
rssi: number;
}

export default class SensorReadingEntity {
constructor(
public id: number,
Expand Down

0 comments on commit acbe7d0

Please sign in to comment.