diff --git a/packages/rocketchat-lib/settings/server/startup.coffee b/packages/rocketchat-lib/settings/server/startup.coffee index 886d1c09b66..74b27863582 100644 --- a/packages/rocketchat-lib/settings/server/startup.coffee +++ b/packages/rocketchat-lib/settings/server/startup.coffee @@ -30,3 +30,14 @@ Meteor.startup -> RocketChat.settings.add 'Meta:robots', '', { type: 'string', group: 'Meta' } RocketChat.settings.add 'Meta:google-site-verification', '', { type: 'string', group: 'Meta' } RocketChat.settings.add 'Meta:msvalidate.01', '', { type: 'string', group: 'Meta' } + + RocketChat.settings.addGroup 'Push' + RocketChat.settings.add 'Push_debug', false, { type: 'boolean', group: 'Push' } + RocketChat.settings.add 'Push_enable', false, { type: 'boolean', group: 'Push' } + RocketChat.settings.add 'Push_production', false, { type: 'boolean', group: 'Push' } + RocketChat.settings.add 'Push_apn_passphrase', '', { type: 'string', group: 'Push' } + RocketChat.settings.add 'Push_apn_key', '', { type: 'string', multiline: true, group: 'Push' } + RocketChat.settings.add 'Push_apn_cert', '', { type: 'string', multiline: true, group: 'Push' } + RocketChat.settings.add 'Push_apn_dev_passphrase', '', { type: 'string', group: 'Push' } + RocketChat.settings.add 'Push_apn_dev_key', '', { type: 'string', multiline: true, group: 'Push' } + RocketChat.settings.add 'Push_apn_dev_cert', '', { type: 'string', multiline: true, group: 'Push' } diff --git a/server/lib/cordova.coffee b/server/lib/cordova.coffee index 255526d2a8e..92bb24fec75 100644 --- a/server/lib/cordova.coffee +++ b/server/lib/cordova.coffee @@ -3,21 +3,22 @@ Meteor.methods console.log.apply console, arguments Meteor.startup -> - Push.debug = true - Push.Configure - apn: - passphrase: '***' - keyData: Assets.getText 'certs/PushRocketChatKey.pem' - certData: Assets.getText 'certs/PushRocketChatCert_development.pem' - gateway: 'gateway.sandbox.push.apple.com' - 'apn-dev': - passphrase: '***' - keyData: Assets.getText 'certs/PushRocketChatKey.pem' - certData: Assets.getText 'certs/PushRocketChatCert_development.pem' - gateway: 'gateway.sandbox.push.apple.com' - production: false - badge: true - sound: true - alert: true - vibrate: true + Push.debug = RocketChat.settings.get 'Push_debug' + + if RocketChat.settings.get('Push_enable') is true + Push.Configure + apn: + passphrase: RocketChat.settings.get 'Push_apn_passphrase' + keyData: RocketChat.settings.get 'Push_apn_key' + certData: RocketChat.settings.get 'Push_apn_cert' + 'apn-dev': + passphrase: RocketChat.settings.get 'Push_apn_dev_passphrase' + keyData: RocketChat.settings.get 'Push_apn_dev_key' + certData: RocketChat.settings.get 'Push_apn_dev_cert' + gateway: 'gateway.sandbox.push.apple.com' + production: RocketChat.settings.get 'Push_production' + badge: true + sound: true + alert: true + vibrate: true