2

I have Laravel running on EC2 instance and I have a .p8 for APNs. Everything is working fine, but I’m wondering what the convention is regarding best location for .p8 files. It doesn’t feel right to just drop them in the base path of the Laravel project.

This seems like a fairly obvious question, but searching around I haven’t found any recommendations regarding best practices on this matter.

Rob
  • 415,655
  • 72
  • 787
  • 1,044

1 Answers1

2

Do you need the .p8 file or just the certificate contents - you could just put it in as an environment variable. That way it's kept separate from your code and specific to the environment it's being used.

Dwight
  • 12,120
  • 6
  • 51
  • 64
  • 1
    Yep, that’s certainly an option. Thanks. – Rob Jan 27 '20 at 19:04
  • How do you specify the .p8 PRIVATE KEY contents as a ENV var since it is multi-line and in between -----BEGIN PRIVATE KEY----- & -----END PRIVATE KEY-----? – Jake Smith Sep 10 '22 at 03:48
  • @JakeSmith You can use `\n` at the start of each of the new lines. See [here](https://stackoverflow.com/questions/55459528/using-private-key-in-a-env-file). – Darryl Young Oct 25 '22 at 13:51