Advertisement
Guest User

Untitled

a guest
Apr 27th, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.98 KB | None | 0 0
  1. var express = require('express');
  2. var ParseServer = require('parse-server').ParseServer;
  3. var app = express();
  4. // Specify the connection string for your mongodb database
  5. // and the location to your Parse cloud code
  6.  
  7. var databaseUri = process.env.DATABASE_URI || 'private';
  8.  
  9. //'mongodb://produser:sd3hw72q9sq@172.31.9.22:27500,172.31.43.0:27500,172.31.36.90:27500/parseprod';
  10.  
  11. //mongodb://produser@172.31.36.90:27500,172.31.43.0:27500,172.31.9.22:27500/parseprod?3t.ssh=true&3t.connection.name=Production+Database&3t.sshUsePKPassphrase=false&3t.uriVersion=2&3t.sshAddress=ec2-52-67-2-183.sa-east-1.compute.amazonaws.com&3t.sshPKPath=/Users/jorgeferro/Library/Mobile Documents/com~apple~CloudDocs/Profissional/Iron Trainers/AWS/irontrainers.pem&3t.sshUser=ubuntu&3t.sshAuthMode=privateKey&readPreference=primary&3t.sharded=true&3t.connectionMode=multi&3t.sshPort=22
  12.  
  13. var S3Adapter = require('parse-server').S3Adapter;
  14.  
  15. var api = new ParseServer({
  16. databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  17. cloud: "/opt/bitnami/apps/parse/htdocs/cloud/main.js",
  18. appId: "private",
  19. masterKey: "private",
  20. fileKey: "8639157b-cef3-4b3e-9f23-c1c83085f886",
  21. enableAnonymousUsers: false,
  22. verifyUserEmails: true,
  23. appName: 'IronTrainers',
  24. serverURL: "private" || 'http://localhost:1337/parse',
  25. publicServerURL: "private",
  26. liveQuery: {
  27. classNames: ["UserConfig", "StaffITMessages"] // List of classes to support for query subscriptions
  28. },
  29.  
  30. push: {
  31. ios: [
  32. {
  33. pfx: '/opt/bitnami/apps/parse/htdocs/certificates/IronTrainersCertificate.p12', // Dev PFX or P12
  34. topic: '-.IRON-TRAINERS',
  35. production: true // Dev
  36. },
  37. {
  38. pfx: '/opt/bitnami/apps/parse/htdocs/certificates/IronTrainersCertificate.p12', // Dev PFX or P12
  39. topic: '-.IRON-TRAINERS',
  40. production: false // Dev
  41. }//,
  42. //{
  43. // pfx: '/home/ubuntu/parsedev/ITMedicalP12.p12', // Prod PFX or P12
  44. // topic: 'apps.IT-Medical',
  45. // production: true // Prod
  46. // }
  47. ],
  48. android:
  49. {
  50. senderId: '407700652754',
  51. apiKey:'private-E0'
  52. }
  53. },
  54. filesAdapter: new S3Adapter(
  55. "private",
  56. "private",
  57. "parse-prod-iron",
  58. {
  59. directAccess: true,
  60. region: "sa-east-1"
  61. }
  62. ),
  63. emailAdapter: {
  64. module: 'parse-server-amazon-ses-email-adapter',
  65. options: {
  66. // The address that your emails come from
  67. fromAddress: 'Iron Trainers <private>',
  68. accessKeyId: 'private',
  69. secretAccessKey: 'private',
  70. region: 'eu-west-1',
  71. // The template section
  72. templates: {
  73. passwordResetEmail: {
  74. subject: 'Redefinir sua senha Iron Trainers',
  75. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/password_reset_email.txt',
  76. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/password_reset_email.html',
  77. callback: (user) => {
  78. return {
  79. nome: user.get("nome"),
  80. sobrenome: user.get("sobrenome")
  81. }
  82. }
  83. // Now you can use {{firstName}} in your templates
  84. },
  85. verificationEmail: {
  86. subject: 'Confirmar email no Iron Trainers',
  87. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/verification_email.txt',
  88. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/resendEmailVerification.html',
  89. pathHtml_en: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/resendEmailVerification.html',
  90. callback: (user) => {
  91. return {
  92. nome: user.get('nome'),
  93. teste: 'this is a test',
  94. }
  95. }
  96. // Now you can use {{firstName}} in your templates
  97. },
  98. customEmailAlert: {
  99. subject: 'Urgent notification!',
  100. pathPlainText: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/custom_alert.txt',
  101. pathHtml: '/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/node_modules/parse-server-amazon-ses-email-adapter/test/email-templates/custom_alert.html',
  102. callback: (user) => {
  103. return {
  104. nome: user.get("nome"),
  105. sobrenome: user.get("sobrenome")
  106. }
  107. }
  108. }
  109. }
  110. }
  111. },
  112. customPages: {
  113. invalidLink: 'http://irontrainers.com.br/members/invalid_link.html',
  114. verifyEmailSuccess: 'http://irontrainers.com.br/members/verify_email_success.html',
  115. choosePassword: 'http://irontrainers.com.br/members/choose_password.html',
  116. passwordResetSuccess: 'http://irontrainers.com.br/members/password_reset_success.html'
  117. }// JavaScript Document
  118. });
  119.  
  120.  
  121. process.on('unhandledRejection', (reason, p) => {
  122. console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
  123. // application specific logging, throwing an error, or other logic here
  124. });
  125.  
  126. // Serve the Parse API on the /parse URL prefix
  127. app.use('/parse', api);
  128.  
  129. var allowInsecureHTTP = true;
  130. var port = 1337;
  131. app.listen(port, function() {
  132. console.log('parse-server running on port ' + port);
  133. });
  134.  
  135. //Parse Dashboard
  136. var ParseDashboard = require('parse-dashboard');
  137. var dashboard = new ParseDashboard({
  138. apps: [
  139. {
  140. appName: "My Bitnami Parse API",
  141. appId: "private",
  142. masterKey: "private",
  143. fileKey: "private-cef3-4b3e-9f23-private",
  144. production: true,
  145. serverURL: "private"
  146. }
  147. ],
  148. users: [
  149. {
  150. user: "private",
  151. pass: "private"
  152. }
  153. ], useEncryptedPasswords: false
  154. }, allowInsecureHTTP);
  155.  
  156.  
  157. //var allowInsecureHTTP = true;
  158.  
  159. // Serve the Parse Dashboard on the /parsedashboard URL prefix
  160. app.use('/', dashboard);
  161.  
  162. var portdash = 4040;
  163. app.listen(portdash, function() {
  164. console.log('parse-dashboard running on port ' + portdash);
  165. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement