Comments (3)
IMO would love to see the effort to get a dev env setup reduced. I think wrapping that in a conditional for running in development would be nice, e.g.
if (process.env.NODE_ENV === 'development' && !process.env.VAPID_MAILTO) {
console.info('VAPID_* env vars not set in development, skipping webPush setup')
} else {
webPush.setVapidDetails(
process.env.VAPID_MAILTO,
process.env.NEXT_PUBLIC_VAPID_PUBKEY,
process.env.VAPID_PRIVKEY
)
}
Alternatively, move the setVapidDetails
call into one (or many) of the async functions so that it just throws on the first time you attempt to do anything with push, rather than during initial render.
from stacker.news.
IMO would love to see the effort to get a dev env setup reduced. I think wrapping that in a conditional for running in development would be nice, e.g.
if (process.env.NODE_ENV === 'development' && !process.env.VAPID_MAILTO) { console.info('VAPID_* env vars not set in development, skipping webPush setup') } else { webPush.setVapidDetails( process.env.VAPID_MAILTO, process.env.NEXT_PUBLIC_VAPID_PUBKEY, process.env.VAPID_PRIVKEY ) }Alternatively, move the
setVapidDetails
call into one (or many) of the async functions so that it just throws on the first time you attempt to do anything with push, rather than during initial render.
Just a +1 here, I used the above quoted code snippet to enable local development and it got me past this issue. Thank you for the workaround!
from stacker.news.
Ah, thanks for the issue and you are right! It doesn't work without setting up these environment variables and we should update our documentation.
For the VAPID keys, you can run npx web-push generate-vapid-keys
. VAPID_MAILTO
should just be a mail prefixed with mailto:
. So mailto:[email protected]
should work.
There may be a similar issue for the imgproxy env but these don't prevent starting the server. However, It may break the frontend when visiting some posts. For IMGPROXY_KEY
and IMGPROXY_SALT
you can run openssl rand -hex 64
.
Would you mind creating a PR to document this? Else I can do this soon.
from stacker.news.
Related Issues (20)
- Add popover support for markdown links to sn items `[]()`
- Search anomaly, is ":" in the title throwing something off?
- Comments non-deterministically missing after submission HOT 7
- Set a reasonable boost max HOT 1
- Can't withdraw sats to Alby Extension HOT 2
- Addition of Naira(NGN) to fiat currencies
- "Unable to get image fees" HOT 1
- Sats forwarded to anon don't go to rewards HOT 1
- Feature Request: Arrows to flip through photos HOT 2
- Prevent new account creation from /login
- Add 'This day on SN' to empty /search page
- Limited rights for "anon" account HOT 2
- Syntax highlighting HOT 9
- Territories have statistics for dates they didn't exist yet HOT 2
- Make dependence on web assembly optional HOT 3
- Top Cowboys page has territory selector which doesn't actually do anything
- Text Overflowing Out Of Bounds For "invoice canceled" Notification HOT 5
- Pull down to refresh on iOS
- No territories on mobile HOT 6
- Undefined comment root in profile items HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stacker.news.