Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endpoint: Read APN certs from environment #240

Closed
oremj opened this issue Nov 20, 2020 · 2 comments · Fixed by #241
Closed

endpoint: Read APN certs from environment #240

oremj opened this issue Nov 20, 2020 · 2 comments · Fixed by #241
Assignees
Labels
5 Estimate - Medium

Comments

@oremj
Copy link
Contributor

oremj commented Nov 20, 2020

Can we read APN certs from the APNS.CHANNELS environment variable instead of looking for files?

Example of what I have now in dev:

{
  "dev": {
    "cert": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n",
    "key": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n"
  },
  "stage": {
    "cert": "-----BEGIN CERTIFICATE-----\n...\n",
    "key": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n"
  }
}
@oremj
Copy link
Contributor Author

oremj commented Nov 20, 2020

I assume this would involve modifying

let cert = tokio::fs::read(settings.cert).await?;
let key = tokio::fs::read(settings.key).await?;
and
pub cert: PathBuf,
pub key: PathBuf,

@jrconlin jrconlin added the 5 Estimate - Medium label Nov 30, 2020
@jrconlin
Copy link
Member

hrm.

so rust's serde::deserializer is pretty clear that it's not a parsing library, and will panic if it encounters a control character inside of a string. Simply replacing newlines with a space would get us past the (lack of) parser.

In addition, we'll probably have to rename the ENV to something like AUTOEND_APNS__CHANNELS

I'm working on trying to get something running locally.

@fzzzy fzzzy closed this as completed in #241 Dec 2, 2020
fzzzy pushed a commit that referenced this issue Dec 2, 2020
* bug: Accept either paths or strings containing the cert for APNS

Closes: #240

* bug: allow APNS env credentials to include serialized keys

Closes #240

* f fix settings comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 Estimate - Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants