From 217abcceeb64b705dde82e1c57541a3e0666450f Mon Sep 17 00:00:00 2001 From: Deepak Date: Wed, 15 Mar 2017 12:06:42 +0530 Subject: [PATCH] added a way to run meteor with settings file --- imports/server/accounts.js | 9 -------- imports/server/accounts/email-templates.js | 25 --------------------- imports/server/accounts/index.js | 2 ++ imports/server/accounts/resetPassword.js | 31 ------------------------- imports/server/accounts/verifyEmail.js | 29 ------------------------ imports/server/emails/config.js | 5 ++--- imports/server/emails/index.js | 5 +++++ imports/server/emails/invite.js | 16 ++++++------- imports/server/emails/resetPassword.js | 30 +++++++++++++++++++++++++ imports/server/emails/verifyEmail.js | 36 ++++++++++++++++++++++++++++++ imports/server/index.js | 3 ++- run/app | 6 +++++ run/app.sh | 4 ++++ run/debug | 8 +++++++ run/echo | 18 +++++++++++++++ run/reset_meteor | 8 +++++++ settings-development.json | 17 ++++++++++++-- 17 files changed, 144 insertions(+), 108 deletions(-) delete mode 100644 imports/server/accounts.js delete mode 100644 imports/server/accounts/email-templates.js create mode 100644 imports/server/accounts/index.js delete mode 100644 imports/server/accounts/resetPassword.js delete mode 100644 imports/server/accounts/verifyEmail.js create mode 100644 imports/server/emails/index.js create mode 100644 imports/server/emails/resetPassword.js create mode 100644 imports/server/emails/verifyEmail.js create mode 100755 run/app create mode 100755 run/app.sh create mode 100755 run/debug create mode 100755 run/echo create mode 100755 run/reset_meteor diff --git a/imports/server/accounts.js b/imports/server/accounts.js deleted file mode 100644 index 78e9231..0000000 --- a/imports/server/accounts.js +++ /dev/null @@ -1,9 +0,0 @@ -import '/imports/server/emails/config'; -import './accounts/email-templates'; -import './accounts/verifyEmail'; -import './accounts/login'; -import './accounts/resetPassword'; -import '/imports/server/emails/invite'; -import '/imports/server/pages/verifyEmail'; - -import './accounts/creation'; diff --git a/imports/server/accounts/email-templates.js b/imports/server/accounts/email-templates.js deleted file mode 100644 index 8fd8f5c..0000000 --- a/imports/server/accounts/email-templates.js +++ /dev/null @@ -1,25 +0,0 @@ -import { Accounts } from 'meteor/accounts-base'; - -const name = 'Application Name'; -const email = ''; -const from = `${name} ${email}`; -const emailTemplates = Accounts.emailTemplates; - -emailTemplates.siteName = name; -emailTemplates.from = from; - -emailTemplates.resetPassword = { - subject() { - return `[${name}] Reset Your Password`; - }, - text(user, url) { - const userEmail = user.emails[0].address; - const urlWithoutHash = url.replace('#/', ''); - - return `A password reset has been requested for the account related to this - address (${userEmail}). To reset the password, visit the following link: - \n\n${urlWithoutHash}\n\n If you did not request this reset, please ignore - this email. If you feel something is wrong, please contact our support team: - ${email}.`; - }, -}; diff --git a/imports/server/accounts/index.js b/imports/server/accounts/index.js new file mode 100644 index 0000000..c96a5f0 --- /dev/null +++ b/imports/server/accounts/index.js @@ -0,0 +1,2 @@ +import './creation'; +import './login'; diff --git a/imports/server/accounts/resetPassword.js b/imports/server/accounts/resetPassword.js deleted file mode 100644 index 8fd0763..0000000 --- a/imports/server/accounts/resetPassword.js +++ /dev/null @@ -1,31 +0,0 @@ -import _ from 'lodash'; -import { Accounts } from 'meteor/accounts-base'; - - -Accounts.emailTemplates.resetPassword = { - subject() { - return '[Blok8] Reset Your Password'; - }, - text(user, url) { - const userEmail = user.emails[0].address; - const theUrl = Meteor.absoluteUrl(`?enter=reset&token=${_.last(url.split('/'))}`); - // const theUrl = decodeURI(`\u003D`); - - return ( -` -Hello, ${user.firstName}! - - -A password reset has been requested for the account related to this address. -To reset the password, visit the following link: - -${theUrl} - -If you did not request this reset, please ignore this email. - -` - ); - }, -}; - - diff --git a/imports/server/accounts/verifyEmail.js b/imports/server/accounts/verifyEmail.js deleted file mode 100644 index 8c8ed3a..0000000 --- a/imports/server/accounts/verifyEmail.js +++ /dev/null @@ -1,29 +0,0 @@ -import _ from 'lodash'; -import { Accounts } from 'meteor/accounts-base'; - -Accounts.config({ - sendVerificationEmail: true -}); - -Accounts.emailTemplates.verifyEmail = { - subject() { - return '[YoungDesk] Verify Your Email Address'; - }, - text(user, url) { - const theUrl = Meteor.absoluteUrl(`back/verifyEmail/${_.last(url.split('/'))}`); - - return ( -` -Hello, ${user.firstName}! - - -To verify your email address, visit the following link: - -${theUrl} - -If you did not request this verification, please ignore this email. - -` - ); - }, -}; diff --git a/imports/server/emails/config.js b/imports/server/emails/config.js index f60b1cb..e85a9fb 100644 --- a/imports/server/emails/config.js +++ b/imports/server/emails/config.js @@ -3,8 +3,7 @@ import { Accounts } from 'meteor/accounts-base'; -if(Meteor.settings.public.environment === 'production') { - process.env.MAIL_URL = "smtp://block8:Ih-DuTSHlO-bdiPE7FBl3Q@smtp.mandrillapp.com:587"; -} +process.env.MAIL_URL = Meteor.settings.private.mandrill.mailUrl; Accounts.emailTemplates.siteName = 'YoungDesk'; Accounts.emailTemplates.from = 'YoungDesk '; +console.log(Accounts.emailTemplates.from); diff --git a/imports/server/emails/index.js b/imports/server/emails/index.js new file mode 100644 index 0000000..a49088f --- /dev/null +++ b/imports/server/emails/index.js @@ -0,0 +1,5 @@ +import '/imports/server/emails/config'; +import '/imports/server/emails/verifyEmail'; +import '/imports/server/emails/resetPassword'; +import '/imports/server/emails/invite'; +import '/imports/server/pages/verifyEmail'; diff --git a/imports/server/emails/invite.js b/imports/server/emails/invite.js index 80feeff..ebb2ad8 100644 --- a/imports/server/emails/invite.js +++ b/imports/server/emails/invite.js @@ -14,9 +14,9 @@ ${url} `; Email.send({ - from: 'Blok 8 ', + from: 'YoungDesk ', to: email, - subject: `[Blok8] Invitation to ${orgName}`, + subject: `[YoungDesk] Invitation`, text: text, }); @@ -30,7 +30,7 @@ The current share price has been changed to $A${price} for the company ${orgName `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] Share price has changed for ${orgName}.`, text: text, @@ -52,7 +52,7 @@ If you did not change your name, please reset your password. `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] - Name Change`, text: text, @@ -75,7 +75,7 @@ If you did not change your password, please reset your password immediately. `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] - Password Change`, text: text, @@ -98,7 +98,7 @@ If you did not change your email address, please contact us immediately by respo `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] - Email Change`, text: text, @@ -120,7 +120,7 @@ ${quantity} ${shareClass} shares in ${orgName} have been issued to you for A$${p `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] New shares have been issued to you in ${orgName}.`, text: text, @@ -139,7 +139,7 @@ Title: ${title}. `; Email.send({ - from: 'Blok 8 ', + from: 'Blok 8 ', to: email, subject: `[Blok8] ${orgName} - New Announcement`, text: text, diff --git a/imports/server/emails/resetPassword.js b/imports/server/emails/resetPassword.js new file mode 100644 index 0000000..c8c20f1 --- /dev/null +++ b/imports/server/emails/resetPassword.js @@ -0,0 +1,30 @@ +import _ from 'lodash'; +import { Accounts } from 'meteor/accounts-base'; + + +Accounts.emailTemplates.resetPassword = { + subject() { + return '[YoungDesk] Reset Your Password'; + }, + text(user, url) { + console.log(user); + const userEmail = user.emails[0].address; + const theUrl = Meteor.absoluteUrl(`?enter=reset&token=${_.last(url.split('/'))}`); + // const theUrl = decodeURI(`\u003D`); + + return ( +` +Hello, ${user.firstName}! + + +A password reset has been requested for the account related to this address. +To reset the password, visit the following link: + +${theUrl} + +If you did not request this reset, please ignore this email. + +` + ); + }, +}; diff --git a/imports/server/emails/verifyEmail.js b/imports/server/emails/verifyEmail.js new file mode 100644 index 0000000..7ef8755 --- /dev/null +++ b/imports/server/emails/verifyEmail.js @@ -0,0 +1,36 @@ +import _ from 'lodash'; +import { Accounts } from 'meteor/accounts-base'; + +Accounts.config({ + sendVerificationEmail: true +}); + +Accounts.emailTemplates.verifyEmail = { + subject() { + return '[YoungDesk] Verify Your Email Address'; + }, + text(user, url) { + console.log(user); + if(user.firstName){ + const name = user.firstName; + }else{ + const name = user.profile.firstName; + } + const name = user.firstName; + const theUrl = Meteor.absoluteUrl(`back/verifyEmail/${_.last(url.split('/'))}`); + + return ( +` +Hello, ${name}! + + +To verify your email address, visit the following link: + +${theUrl} + +If you did not request this verification, please ignore this email. + +` + ); + }, +}; diff --git a/imports/server/index.js b/imports/server/index.js index 313732b..e680826 100644 --- a/imports/server/index.js +++ b/imports/server/index.js @@ -1,4 +1,5 @@ -import './accounts'; +import './accounts/index'; import './collections'; import './browser-policy'; import './fixtures'; +import './emails/index'; diff --git a/run/app b/run/app new file mode 100755 index 0000000..0d97a34 --- /dev/null +++ b/run/app @@ -0,0 +1,6 @@ +#!/bin/bash + +# "0123012301230123" +./run/echo "START METEOR APP" + +meteor --settings settings-development.json diff --git a/run/app.sh b/run/app.sh new file mode 100755 index 0000000..d16c1c5 --- /dev/null +++ b/run/app.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# "0123012301230123" +meteor --settings settings-development.json diff --git a/run/debug b/run/debug new file mode 100755 index 0000000..d89b913 --- /dev/null +++ b/run/debug @@ -0,0 +1,8 @@ +#!/bin/bash + +# "0123012301230123" +./run/echo "APP INSPECT MODE" + +cd app && FORCE_COLOR=true NODE_OPTIONS='--inspect' meteor --settings settings-development.json + + diff --git a/run/echo b/run/echo new file mode 100755 index 0000000..8afa734 --- /dev/null +++ b/run/echo @@ -0,0 +1,18 @@ +#!/bin/bash + + +echo -e "" +echo -e "" +echo -e "\033[96m\033[1m ╔════════════════════════╗ \033[0m" +echo -e "\033[96m\033[1m ║ ╔════════════════════╗ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ YoungDesk ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ╟────────────────────╢ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ \033[91m\033[1m$1\033[96m\033[1m ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" +echo -e "\033[96m\033[1m ║ ╚══════╗\033[91m\033[1m╔════╗\033[96m\033[1m╔══════╝ ║ \033[0m" +echo -e "\033[96m\033[1m ╚════════╝\033[91m\033[1m╚════╝\033[96m\033[1m╚════════╝ \033[0m" +echo -e "" +echo -e "" diff --git a/run/reset_meteor b/run/reset_meteor new file mode 100755 index 0000000..766b591 --- /dev/null +++ b/run/reset_meteor @@ -0,0 +1,8 @@ +#!/bin/bash + +# "0123012301230123" +./run/echo "RESET METEOR APP" + +cd app && FORCE_COLOR=true meteor reset + + diff --git a/settings-development.json b/settings-development.json index d577f2b..b5fd3d1 100644 --- a/settings-development.json +++ b/settings-development.json @@ -1,4 +1,17 @@ { - "public": {}, - "private": {} + "private": { + "twilio": { + "accountSID": "", + "authToken": "", + "from": "" + }, + "mandrill": { + "key": "jr9TRxivdGDrsyI_bmRZLg", + "testKey": "UbqDNTDINDq5fCAkzb0-DQ", + "mailUrl": "smtp://Youngdesk:3AY0e6pF9Alpv5-GjrQxAA@smtp.mandrillapp.com:587" + } + }, + "public": { + "environment": "development" + } } -- 2.0.0