Skip to content

Commit

Permalink
adding tpng to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Apr 5, 2020
1 parent a436900 commit f9a0ae8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
12 changes: 9 additions & 3 deletions docker/tinode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker file builds an image with a tinode chat server.
#
# In order to run the image you have to link it to a running database container. For example, to
# In order to run the image you have to link it to a running database container. For example, to
# to use RethinkDB (named 'rethinkdb') and map the port where the tinode server accepts connections:
#
# $ docker run -p 6060:6060 -d --link rethinkdb \
Expand Down Expand Up @@ -83,6 +83,12 @@ ENV TLS_ENABLED=false

# Disable push notifications by default.
ENV FCM_PUSH_ENABLED=false
# Declare FCM-related vars
ENV FCM_API_KEY=
ENV FCM_APP_ID=
ENV FCM_SENDER_ID=
ENV FCM_PROJECT_ID=
ENV FCM_VAPID_KEY=

# Enable Android-specific notifications by default.
ENV FCM_INCLUDE_ANDROID_NOTIFICATION=true
Expand All @@ -93,8 +99,8 @@ ENV TNPG_PUSH_ENABLED=false
# Tinode Push Gateway authentication token.
ENV TNPG_AUTH_TOKEN=

# Tinode Push Gateway user name.
ENV TNPG_USER=
# Tinode Push Gateway organization name as registered at console.tinode.co
ENV TNPG_ORG=

# Use the target db by default.
# When TARGET_DB is "alldbs", it is the user's responsibility
Expand Down
5 changes: 2 additions & 3 deletions docker/tinode/config.template
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,14 @@
"name":"tnpg",
"config": {
"enabled": $TNPG_PUSH_ENABLED,
"auth_token": "$TNPG_AUTH_TOKEN",
"user": "$TNPG_USER"
"token": "$TNPG_AUTH_TOKEN",
"org": "$TNPG_USER"
}
},
{
"name":"fcm",
"config": {
"enabled": $FCM_PUSH_ENABLED,
"buffer": 1024,
"project_id": "$FCM_PROJECT_ID",
"credentials_file": "$FCM_CRED_FILE",
"time_to_live": 3600,
Expand Down
6 changes: 5 additions & 1 deletion docker/tinode/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ else
FCM_PUSH_ENABLED=true
fi

if [ ! -z "$TNPG_AUTH_TOKEN" ] ; then
TNPG_PUSH_ENABLED=true
fi

# Generate a new 'working.config' from template and environment
while IFS='' read -r line || [[ -n $line ]] ; do
while [[ "$line" =~ (\$[A-Z_][A-Z_0-9]*) ]] ; do
Expand All @@ -60,7 +64,7 @@ if [ "$UPGRADE_DB" = "true" ] ; then
fi

# If push notifications are enabled, generate client-side firebase config file.
if [ ! -z "$FCM_PUSH_ENABLED" ] ; then
if [ ! -z "$FCM_PUSH_ENABLED" ] || [ ! -z "$TNPG_PUSH_ENABLED" ] ; then
# Write client config to $STATIC_DIR/firebase-init.js
cat > $STATIC_DIR/firebase-init.js <<- EOM
const FIREBASE_INIT = {
Expand Down
2 changes: 1 addition & 1 deletion server/tinode.conf
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
"config": {
// Disabled. Configure first then enable.
"enabled": false,
// Name of the organization you registered at console.tinode.co.
// Name of the organization you registered at console.tinode.co.
"org": "test",
// Authentication token obtained from console.tinode.co
"token": "jwt-security-token-obtained-from-console.tinode.co",
Expand Down

0 comments on commit f9a0ae8

Please sign in to comment.