Remove the hardcoded lbry API address
This commit is contained in:
parent
4dccedc5d0
commit
97e4c9234f
2 changed files with 13 additions and 6 deletions
|
@ -35,4 +35,8 @@ module.exports = {
|
||||||
testChannel : '@testpublishchannel', // a channel to make test publishes in
|
testChannel : '@testpublishchannel', // a channel to make test publishes in
|
||||||
testChannelPassword: 'password', // password for the test channel
|
testChannelPassword: 'password', // password for the test channel
|
||||||
},
|
},
|
||||||
|
api: {
|
||||||
|
apiUri: 'localhost',
|
||||||
|
apiPort: '5279',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
|
const config = require('../config/speechConfig.js');
|
||||||
|
const { apiUri, apiPort } = config.api;
|
||||||
|
const lbryApiUrl = 'http://' + apiUri + ':' + apiPort;
|
||||||
|
|
||||||
function handleLbrynetResponse ({ data }, resolve, reject) {
|
function handleLbrynetResponse ({ data }, resolve, reject) {
|
||||||
logger.debug('lbry api data:', data);
|
logger.debug('lbry api data:', data);
|
||||||
|
@ -22,7 +25,7 @@ module.exports = {
|
||||||
logger.debug(`lbryApi >> Publishing claim to "${publishParams.name}"`);
|
logger.debug(`lbryApi >> Publishing claim to "${publishParams.name}"`);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'publish',
|
method: 'publish',
|
||||||
params: publishParams,
|
params: publishParams,
|
||||||
})
|
})
|
||||||
|
@ -38,7 +41,7 @@ module.exports = {
|
||||||
logger.debug(`lbryApi >> Getting Claim for "${uri}"`);
|
logger.debug(`lbryApi >> Getting Claim for "${uri}"`);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { uri, timeout: 20 },
|
params: { uri, timeout: 20 },
|
||||||
})
|
})
|
||||||
|
@ -54,7 +57,7 @@ module.exports = {
|
||||||
logger.debug(`lbryApi >> Getting claim_list for "${claimName}"`);
|
logger.debug(`lbryApi >> Getting claim_list for "${claimName}"`);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'claim_list',
|
method: 'claim_list',
|
||||||
params: { name: claimName },
|
params: { name: claimName },
|
||||||
})
|
})
|
||||||
|
@ -71,7 +74,7 @@ module.exports = {
|
||||||
// console.log('resolving uri', uri);
|
// console.log('resolving uri', uri);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'resolve',
|
method: 'resolve',
|
||||||
params: { uri },
|
params: { uri },
|
||||||
})
|
})
|
||||||
|
@ -91,7 +94,7 @@ module.exports = {
|
||||||
logger.debug('lbryApi >> Retrieving the download directory path from lbry daemon...');
|
logger.debug('lbryApi >> Retrieving the download directory path from lbry daemon...');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'settings_get',
|
method: 'settings_get',
|
||||||
})
|
})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
|
@ -110,7 +113,7 @@ module.exports = {
|
||||||
createChannel (name) {
|
createChannel (name) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post('http://localhost:5279/lbryapi', {
|
.post(lbryApiUrl, {
|
||||||
method: 'channel_new',
|
method: 'channel_new',
|
||||||
params: {
|
params: {
|
||||||
channel_name: name,
|
channel_name: name,
|
||||||
|
|
Loading…
Reference in a new issue