From 92786795d2742abec58f60f220dd90381cd05796 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 12 Jun 2017 14:56:40 -0700 Subject: [PATCH] added config npm --- config/custom-environment-variables.json | 8 ++++++++ config/default.json | 8 ++++++++ helpers/socketHelpers.js | 6 ++++-- package.json | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 config/custom-environment-variables.json create mode 100644 config/default.json diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json new file mode 100644 index 00000000..c3ac0d80 --- /dev/null +++ b/config/custom-environment-variables.json @@ -0,0 +1,8 @@ +{ + "WalletConfig": { + "lbryAddress": "LBRY_WALLET_ADDRESS" + }, + "AnalyticsConfig":{ + "googleId": "GOOGLE_ANALYTICS_ID" + } +} \ No newline at end of file diff --git a/config/default.json b/config/default.json new file mode 100644 index 00000000..17c51244 --- /dev/null +++ b/config/default.json @@ -0,0 +1,8 @@ +{ + "WalletConfig": { + "lbryAddress": "none" + }, + "AnalyticsConfig":{ + "googleId": "none" + } +} \ No newline at end of file diff --git a/helpers/socketHelpers.js b/helpers/socketHelpers.js index 6a3a7638..45c67e39 100644 --- a/helpers/socketHelpers.js +++ b/helpers/socketHelpers.js @@ -1,5 +1,7 @@ var fs = require('fs'); var lbryApi = require('../helpers/lbryApi.js'); +var config = require('config'); +var walledAddress = config.get('WalletConfig.lbryAddress'); function handlePublishError(error) { if (error.code === "ECONNREFUSED"){ @@ -24,8 +26,8 @@ function createPublishParams(name, filepath, license, nsfw) { "license": license, "nsfw": (nsfw.toLowerCase() === "true") }, - "claim_address": "", // fill in wallet address - "change_address": "" // fill in wallet address; requires daemon 0.12.2rc1 or above + "claim_address": walledAddress, + "change_address": walledAddress //requires daemon 0.12.2rc1 or above }; return publishParams; } diff --git a/package.json b/package.json index 799ceade..fe250769 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "dependencies": { "axios": "^0.16.1", "body-parser": "^1.17.1", + "config": "^1.26.1", "express": "^4.15.2", "express-handlebars": "^3.0.0", "nodemon": "^1.11.0",