Read vapid subject from the environment
Load the contact details for push notifications from the NUXT_VAPID_SUBJECT environment variable.
This commit is contained in:
parent
c986d939ec
commit
a16921f264
2 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,7 @@ export default defineNuxtConfig({
|
|||
devtools: { enabled: true },
|
||||
runtimeConfig: {
|
||||
cookieSecretKey: "",
|
||||
vapidSubject: "",
|
||||
vapidPrivateKey: "",
|
||||
public: {
|
||||
defaultTimezone: "Europe/Oslo",
|
||||
|
|
|
@ -14,11 +14,12 @@ function useVapidDetails(event: H3Event) {
|
|||
}
|
||||
|
||||
const runtimeConfig = useRuntimeConfig(event);
|
||||
if (!runtimeConfig.vapidSubject) throw new Error("NUXT_VAPID_SUBJECT not set.")
|
||||
if (!runtimeConfig.public.vapidPublicKey) throw new Error("NUXT_PUBLIC_VAPID_PUBLIC_KEY not set.")
|
||||
if (!runtimeConfig.vapidPrivateKey) throw new Error("NUXT_VAPID_PRIVATE_KEY not set.")
|
||||
|
||||
return cachedVapidDetails = {
|
||||
subject: "mailto:webmaster@hornwitser.no",
|
||||
subject: runtimeConfig.vapidSubject,
|
||||
publicKey: runtimeConfig.public.vapidPublicKey,
|
||||
privateKey: runtimeConfig.vapidPrivateKey,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue