Search code examples
node.jsherokuapple-push-notificationspem

key for pem file in node js heroku


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.


Solution

  • 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.

    See Enabling HTTPS on express.js