parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse Server Push - Path to certificates

Open oyvindvol opened this issue 10 years ago • 3 comments

I am setting up the new Parse Server Push feature on Parse Server hosted on Heroku.

The Wiki says: ios: { pfx: '/file/path/to/XXX.p12', ... }

Is it possible to upload the certificates to Heroku somewhere? How do I get them up there, and what will the path to them be like?

oyvindvol avatar Feb 12 '16 12:02 oyvindvol

The simplest solution would be to check them in to your repo. If you wish to avoid that for any reason (if, say, your app is open source and lives in a public repo) then the solution will depend on your exact setup and needs. We probably wouldn't be able to help you with that.

drew-gross avatar Feb 12 '16 17:02 drew-gross

Hi @oyvindvol, suppose you certificate is push.p12, you can just put that file under your project root's folder(eg. The same folder of your package.json). The configuration should be ios: { pfx: 'push.p12'}.

wangmengyan95 avatar Feb 12 '16 18:02 wangmengyan95

Don't check config into your repo, especially private keys..

You can store the contents in an environment variable on Heroku. See this StackOverflow post where I got the idea, and this SO post which illustrates storing a binary file in an env variable by base64 encode / decode.

Edit containing my full solution:

  1. Set your environment variable using heroku config:set APNS_KEY="$(base64 /path/to/key.p12)"
  2. Add a heroku-prebuild script to your package.json: echo $APNS_KEY | base64 --decode > key.p12
  3. In your Parse Server config, set push.ios.pfx = path.join(__dirname, 'key.p12')

connorbode avatar Dec 08 '16 03:12 connorbode