I got the following code for apple push service:
agent .set('cert file', join(__dirname, 'cert.pem')) .set('key file', join(__dirname, 'key.pem')) .enable('sandbox');
When I run my server on localhost, I enter pem key, and server starts working.
How can I set it to be entered automatically, because I deploy it on heroku I do
git push heroku master
and server fails because I didn't enter pem key.
Problem courtesy of: Slow Harry
I used these commands:
openssl genrsa -out privatekey.pem 1024 openssl req -new -key privatekey.pem -x509 -days 7300 -out certificate.pem
I used them in Node.js HTTPS server.
Solution courtesy of: leesei
Does the library you use to send notifications support passing the string data of the certificate/key? You can try adding the contents as environment variables on heroku using the
command. For instance:
heroku config:set CERT_DATA='content of the file'
You can then reference
in your code rather than reading the file. You will also need a way to set the environment variables during development, but I'm not familiar enough with the tools that are available to suggest how to do that.
Discussion courtesy of: Adam
This recipe can be found in it's original form on Stack Over Flow .