Skip to content

Commit 6945109

Browse files
committed
Allow for using absolute paths for certificates
1 parent 9f84dcf commit 6945109

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you want to use `APNS` token authentication you need to provide token and set
3131
https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token_based_connection_to_apns
3232
To see how to obtain `team_id` read: https://www.mobiloud.com/help/knowledge-base/ios-app-transfer/
3333
`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`
34-
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:
34+
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:
3535

3636
```bash
3737
docker run -v `pwd`/priv:/opt/app/priv \
@@ -64,8 +64,8 @@ Environmental variables to configure production release:
6464
##### Settings for HTTP endpoint:
6565
* `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"
6666
* `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
67-
* `PUSH_HTTPS_KEYFILE` - Path to a PEM keyfile used for HTTP endpoint
68-
* `PUSH_HTTPS_CERTFILE` - Path to a PEM certfile used for HTTP endpoint
67+
* `PUSH_HTTPS_KEYFILE` - Path to a PEM keyfile used for HTTP endpoint (must be aabsolute).
68+
* `PUSH_HTTPS_CERTFILE` - Path to a PEM certfile used for HTTP endpoint.
6969
* `PUSH_HTTPS_ACCEPTORS` - Number of TCP acceptors to start
7070

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

7878
##### Settings for FCM service:
7979
* `PUSH_FCM_ENDPOINT` - Hostname of `FCM` service. Set only for local testing. By default this option points to the Google's official hostname
80-
* `PUSH_FCM_APP_FILE` - Path to `FCM` service account JSON file. For details look at **Running from DockerHub** section
80+
* `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
8181
* `PUSH_FCM_POOL_SIZE` - Connection pool size for `FCM` service
8282

8383
##### Settings for development APNS service:
8484
* `PUSH_APNS_DEV_ENDPOINT` - Hostname of `APNS` service. Set only for local testing. By default this option points to the Apple's official hostname
85-
* `PUSH_APNS_DEV_CERT` - Path Apple's development certfile used to communicate with `APNS`
86-
* `PUSH_APNS_DEV_KEY` - Path Apple's development keyfile used to communicate with `APNS`
85+
* `PUSH_APNS_DEV_CERT` - Path to Apple's development certfile used to communicate with `APNS` (absolute or relative to `/opt/app/priv/`)
86+
* `PUSH_APNS_DEV_KEY` - Path to Apple's development keyfile used to communicate with `APNS` (absolute or relative to `/opt/app/priv/`)
8787
* `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*
8888
* `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*
89-
* `PUSH_APNS_DEV_P8_TOKEN` - Token generated from Apple's developer console. For details look at **Running from DockerHub** section
89+
* `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
9090
* `PUSH_APNS_DEV_USE_2197` - `true`/`false` - Enable or disable use of alternative `2197` port for `APNS` connections in development mode. Disabled by default
9191
* `PUSH_APNS_DEV_POOL_SIZE` - Connection pool size for `APNS` service in development mode
9292
* `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

lib/mongoose_push/application.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ defmodule MongoosePush.Application do
118118

119119
defp check_paths(config, path_keys) do
120120
Enum.map(config, fn {key, value} ->
121-
case Enum.member?(path_keys, key) do
122-
true ->
123-
{key, Application.app_dir(:mongoose_push, value)}
124-
125-
false ->
121+
with true <- Enum.member?(path_keys, key),
122+
:relative <- Path.type(value) do
123+
{key, Application.app_dir(:mongoose_push, value)}
124+
else
125+
_ ->
126126
{key, value}
127127
end
128128
end)

0 commit comments

Comments
 (0)