Question

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.

Was it helpful?

Solution 2

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

OTHER TIPS

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 heroku config command. For instance:

heroku config:set CERT_DATA='content of the file'

You can then reference CERT_DATA 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top