From a17c88a0d02063dbf3eae65ab174f47371483d89 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Tue, 18 Aug 2015 12:27:07 +0200 Subject: [PATCH] use meteor settings instead of custom source file --- .gitignore | 1 + README.md | 18 ++++++++++-------- server/accounts.coffee | 8 ++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e38da20 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +settings.json diff --git a/README.md b/README.md index 5c18257..1813793 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,19 @@ since the apps now depends on Meteor's #### Twitter Authentication -Create this file: `server/settings.coffee` with this content: +Create a `json` file with this content: -```coffeescript -Meteor.startup -> - Accounts.loginServiceConfiguration.remove service : 'twitter' - Accounts.loginServiceConfiguration.insert - service: 'twitter' - consumerKey: 'Your API key' - secret: 'Your API secret' +```json +{ + "twitter" : { + "apiKey": "your_twitter_api_key", + "secret": "your_twitter_api_secret" + } +} ``` +Now run or deploy the application with the `--settings yourfile.json` parameter. + Your users will now be able to login using twitter. You may want to disable the button if you don't configure twitter authentication. diff --git a/server/accounts.coffee b/server/accounts.coffee index a4790fb..7de757a 100644 --- a/server/accounts.coffee +++ b/server/accounts.coffee @@ -28,3 +28,11 @@ Accounts.emailTemplates.verifyEmail.text = (user,url) -> url = Meteor.absoluteUrl 'verify/'+token '''Welcome to MarkCloud! To activate your account, click on the \ following link: '''+url + +# Twitter configuration code +Meteor.startup -> + Accounts.loginServiceConfiguration.remove service : 'twitter' + if Meteor.settings.twitter? then Accounts.loginServiceConfiguration.insert + service: 'twitter' + consumerKey: Meteor.settings.twitter.apiKey + secret: Meteor.settings.twitter.secret