Skip to content

Commit

Permalink
Allow for using absolute paths for certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
rslota committed May 25, 2020
1 parent 9f84dcf commit 6945109
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you want to use `APNS` token authentication you need to provide token and set
https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token_based_connection_to_apns
To see how to obtain `team_id` read: https://www.mobiloud.com/help/knowledge-base/ios-app-transfer/
`FCM` JSON file can be generated by Firebase console (https://console.firebase.google.com). Go to your project -> `Project Settings` -> `Service accounts` -> `Generate new private key`
Assuming that you have the `priv` directory with all ceriticates and fcm token in current directory, then you may start MongoosePush with the following command:
Assuming that you have the `priv` directory with all certificates and fcm token in current directory, then you may start MongoosePush with the following command:

```bash
docker run -v `pwd`/priv:/opt/app/priv \
Expand Down Expand Up @@ -64,8 +64,8 @@ Environmental variables to configure production release:
##### Settings for HTTP endpoint:
* `PUSH_HTTPS_BIND_ADDR` - Bind IP address of the HTTP endpoint. Default value in prod release is "127.0.0.1", but docker overrides this with "0.0.0.0"
* `PUSH_HTTPS_PORT` - The port of the MongoosePush HTTP endpoint. Please note that docker exposes only `8443` port, so changing this setting is not recommended
* `PUSH_HTTPS_KEYFILE` - Path to a PEM keyfile used for HTTP endpoint
* `PUSH_HTTPS_CERTFILE` - Path to a PEM certfile used for HTTP endpoint
* `PUSH_HTTPS_KEYFILE` - Path to a PEM keyfile used for HTTP endpoint (must be aabsolute).
* `PUSH_HTTPS_CERTFILE` - Path to a PEM certfile used for HTTP endpoint.
* `PUSH_HTTPS_ACCEPTORS` - Number of TCP acceptors to start

##### General settings:
Expand All @@ -77,16 +77,16 @@ Environmental variables to configure production release:

##### Settings for FCM service:
* `PUSH_FCM_ENDPOINT` - Hostname of `FCM` service. Set only for local testing. By default this option points to the Google's official hostname
* `PUSH_FCM_APP_FILE` - Path to `FCM` service account JSON file. For details look at **Running from DockerHub** section
* `PUSH_FCM_APP_FILE` - Path to `FCM` service account JSON file (absolute or relative to `/opt/app/priv/`). For details look at **Running from DockerHub** section
* `PUSH_FCM_POOL_SIZE` - Connection pool size for `FCM` service

##### Settings for development APNS service:
* `PUSH_APNS_DEV_ENDPOINT` - Hostname of `APNS` service. Set only for local testing. By default this option points to the Apple's official hostname
* `PUSH_APNS_DEV_CERT` - Path Apple's development certfile used to communicate with `APNS`
* `PUSH_APNS_DEV_KEY` - Path Apple's development keyfile used to communicate with `APNS`
* `PUSH_APNS_DEV_CERT` - Path to Apple's development certfile used to communicate with `APNS` (absolute or relative to `/opt/app/priv/`)
* `PUSH_APNS_DEV_KEY` - Path to Apple's development keyfile used to communicate with `APNS` (absolute or relative to `/opt/app/priv/`)
* `PUSH_APNS_DEV_KEY_ID` - Key ID generated from Apple's developer console. For details look at **Running from DockerHub** section *required for token authentication*
* `PUSH_APNS_DEV_TEAM_ID` - TEAM ID generated from Apple's developer console. For details look at **Running from DockerHub** section *required for token authenticaton*
* `PUSH_APNS_DEV_P8_TOKEN` - Token generated from Apple's developer console. For details look at **Running from DockerHub** section
* `PUSH_APNS_DEV_P8_TOKEN` - Path to file containing token generated from Apple's developer console (absolute or relative to `/opt/app/priv/`). For details look at **Running from DockerHub** section
* `PUSH_APNS_DEV_USE_2197` - `true`/`false` - Enable or disable use of alternative `2197` port for `APNS` connections in development mode. Disabled by default
* `PUSH_APNS_DEV_POOL_SIZE` - Connection pool size for `APNS` service in development mode
* `PUSH_APNS_DEV_DEFAULT_TOPIC` - Default `APNS` topic to be set if the client app doesn't specify it with the API call. If this option is not set, MongoosePush will try to extract this value from the provided APNS certificate (the first topic will be assumed default). DEV certificates normally don't provide any topics, so this option can be safely left unset
Expand Down
10 changes: 5 additions & 5 deletions lib/mongoose_push/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ defmodule MongoosePush.Application do

defp check_paths(config, path_keys) do
Enum.map(config, fn {key, value} ->
case Enum.member?(path_keys, key) do
true ->
{key, Application.app_dir(:mongoose_push, value)}

false ->
with true <- Enum.member?(path_keys, key),
:relative <- Path.type(value) do
{key, Application.app_dir(:mongoose_push, value)}
else
_ ->
{key, value}
end
end)
Expand Down

0 comments on commit 6945109

Please sign in to comment.