-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from hodlforjesus/fb-carver2d
Webpack 3->4 migration, split secrets config, beginning reddit integration
- Loading branch information
Showing
10 changed files
with
1,172 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Keep all your API & secrets here. DO NOT IMPORT THIS FILE IN /client folder | ||
*/ | ||
const secretsConfig = { | ||
db: { | ||
host: '127.0.0.1', | ||
port: '27017', | ||
name: 'blockex', | ||
user: 'blockexuser', | ||
pass: 'Explorer!1' | ||
}, | ||
rpc: { | ||
host: '127.0.0.1', | ||
port: '52541', | ||
user: 'bulwarkrpc', | ||
pass: 'someverysafepassword', | ||
timeout: 8000, // 8 seconds | ||
}, | ||
} | ||
|
||
module.exports = { secretsConfig }; // This is returned as an object on purpose so you have to be explicit at stating that you are accessing a secrets config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
require('babel-polyfill'); | ||
const config = require('../../config'); | ||
const { exit, rpc } = require('../../lib/cron'); | ||
const fetch = require('../../lib/fetch'); | ||
const locker = require('../../lib/locker'); | ||
const moment = require('moment'); | ||
// Models. | ||
const Coin = require('../../model/coin'); | ||
const { CarverAddress, CarverMovement } = require('../../model/carver2d'); | ||
const { CarverAddressType } = require('../../lib/carver2d'); | ||
const { TimeInterval } = require('../../model/timeInterval'); | ||
const { BlockRewardDetails } = require('../../model/blockRewardDetails'); | ||
const { TimeIntervalType, TimeIntervalColumn } = require('../../lib/timeInterval'); | ||
|
||
/** | ||
* Gets most reddit posts and stores them in db for later use | ||
*/ | ||
const syncRedditPosts = async () => { | ||
} | ||
|
||
/** | ||
* Handle locking. | ||
*/ | ||
async function update() { | ||
const type = 'social_reddit'; | ||
let code = 0; | ||
|
||
try { | ||
locker.lock(type); | ||
await syncRedditPosts(); | ||
} catch (err) { | ||
console.log(err); | ||
code = 1; | ||
} finally { | ||
try { | ||
locker.unlock(type); | ||
} catch (err) { | ||
console.log(err); | ||
code = 1; | ||
} | ||
exit(code); | ||
} | ||
} | ||
|
||
update(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
|
||
const config = require('../config'); | ||
const { secretsConfig } = require('../config.server'); | ||
const promise = require('bluebird'); | ||
|
||
/** | ||
* Return the DSN string for the mongodb connection. | ||
*/ | ||
const getDSN = () => { | ||
return `mongodb://${ config.db.host }:${ config.db.port }/${ config.db.name }`; | ||
return `mongodb://${secretsConfig.db.host}:${secretsConfig.db.port}/${secretsConfig.db.name}`; | ||
}; | ||
|
||
/** | ||
* Return the options for the mongodb connection. | ||
*/ | ||
const getOptions = () => { | ||
return { | ||
auth: { authdb: config.db.name }, | ||
auth: { authdb: secretsConfig.db.name }, | ||
native_parser: true, | ||
pass: config.db.pass, | ||
pass: secretsConfig.db.pass, | ||
promiseLibrary: promise, | ||
user: config.db.user | ||
user: secretsConfig.db.user | ||
}; | ||
}; | ||
|
||
module.exports = { | ||
module.exports = { | ||
getDSN, | ||
getOptions | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.