From 435bb1fb44cdac296d1fcd01d009beefbcffd6db Mon Sep 17 00:00:00 2001 From: loddit Date: Sun, 16 Aug 2015 16:08:19 +0800 Subject: [PATCH] use config file over hardcode account info --- .gitignore | 3 +++ legilimens.coffee | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..02d0c7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +dist +.config.json diff --git a/legilimens.coffee b/legilimens.coffee index 96da14d..6ad306f 100644 --- a/legilimens.coffee +++ b/legilimens.coffee @@ -1,13 +1,16 @@ request = require('request') +fs = require('fs') + +config = JSON.parse(fs.readFileSync('.config.json','utf8')) GITHUB_REPO_API_ROOT = "https://api.github.com/repos/" LATEST_RELEASE_PATH = "/releases/latest" RECENT_CLOSED_PR_PATH = "/pulls?state=closed&sort=updated&direction=desc" -username = 'yourname' -password = 'password' -repoOwner = 'repo/owner' -repoName = 'reponame' +username = config.username +password = config.password +repoOwner = config.repo_owner +repoName = config.repo_name repoUrl = "#{GITHUB_REPO_API_ROOT}#{repoOwner}/#{repoName}"