Skip to content

Commit

Permalink
Merge pull request #146 from jupiter-project/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
joramirezStackit authored Feb 23, 2022
2 parents bcf0a22 + e1d0d68 commit fb50658
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/tag.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jobs:
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Tag image
run: docker tag metis ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ steps.tag.outputs.tag }}
- name: Docker logout
run: docker logout
- name: Docker login
run: docker login
run: docker tag metis registry.digitalocean.com/metis/metis:${{ steps.tag.outputs.tag }}
- name: Push image to DO Container Registry
run: docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ steps.tag.outputs.tag }}
run: docker push registry.digitalocean.com/metis/metis:${{ steps.tag.outputs.tag }}
- name: Channel specific notification Slack
uses: adamkdean/simple-slack-notify@master
env:
Expand Down
Binary file removed certificates/apn.p12
Binary file not shown.
3 changes: 2 additions & 1 deletion config/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ function sendApplePN(token, alertMessage, badgeCount, payload, category){
// setTimeout(async () => {
return apnProvider.send(notification, token)
.then(result=>{
// logger.debug(JSON.stringify(result));
logger.debug(`${result}`);
apnProvider.shutdown(); // close all open connections when queue is fully drained.
})
.catch(error => logger.error(`Error sending PN ${error}`))
// }, delay);
}

Expand Down
18 changes: 5 additions & 13 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ const { tokenVerify } = require('./middlewares/authentication');
const {externalResourcesCheck} = require('./middlewares/externalResourcesCheck');
const firebaseAdmin = require("firebase-admin");
// Firebase Service initializer
const firebaseServiceAccount = {
type: process.env.FIREBASE_TYPE,
project_id: process.env.FIREBASE_PROJECT_ID,
private_key_id: process.env.FIREBASE_PRIVATE_KEY_ID,
private_key: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n') ,
client_email: process.env.FIREBASE_CLIENT_EMAIL,
client_id: process.env.FIREBASE_CLIENT_ID,
auth_uri: process.env.FIREBASE_AUTH_URI,
token_uri: process.env.FIREBASE_TOKEN_URI,
auth_provider_x509_cert_url: process.env.FIREBASE_AUTH_PROVIDER_X509_CERT_URL,
client_x509_cert_url: process.env.FIREBASE_CLIENT_X509_CERT_URL
};

module.exports.firebaseAdmin = firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert(firebaseServiceAccount)
credential: firebaseAdmin.credential.cert({
projectId: process.env.FIREBASE_PROJECT_ID,
clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
privateKey: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n') ,
})
});
const url = require('url');
// const kue = require('kue');
Expand Down
3 changes: 3 additions & 0 deletions services/firebaseService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {firebaseAdmin} from '../server';
const logger = require('../utils/logger')(module);

/**
*
Expand Down Expand Up @@ -33,6 +34,8 @@ class FirebaseService {
}

return this.firebaseAdmin.messaging().sendToDevice(registrationToken, message, options)
.then(result => logger.debug(`${result}`))
.catch(error => console.log('Error sending Android PN', error))
}

/**
Expand Down
2 changes: 1 addition & 1 deletion services/pushNotificationTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {
})
},
editMutedChannels: (req, res) => {
const { userData: { address: userAddress } } = req.user;
const { address: userAddress } = req.user;
const { channelAddress, isMuted } = req.body;

if (!channelAddress) {
Expand Down

0 comments on commit fb50658

Please sign in to comment.