문제

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.

도움이 되었습니까?

해결책 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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top