chore(portal-api): Bootstrap data

This commit is contained in:
geek 2017-06-21 11:15:17 -05:00 committed by Sérgio Ramos
parent 67aedbdc54
commit c30b688ee9
2 changed files with 14 additions and 2 deletions

View File

@ -11,7 +11,11 @@ const ifError = function (err) {
};
const bootstrap = function () {
const data = new Data();
const data = new Data({
db: {
host: process.env.RETHINK_HOST || 'localhost'
}
});
data.connect(() => {
data.createDatacenter({ region: 'us-sw-1', name: 'us-sw-1' }, (err, datacenter) => {
@ -34,7 +38,11 @@ const bootstrap = function () {
};
const main = function () {
const dropData = new Data();
const dropData = new Data({
db: {
host: process.env.RETHINK_HOST || 'localhost'
}
});
dropData.connect(() => {
dropData._db.r.dbDrop('portal').run(dropData._db._connection, () => {

View File

@ -1,6 +1,10 @@
{
consul: 'localhost:8500',
jobs: [
{
name: 'bootstrap',
exec: 'node bootstrap-data.js'
},
{
name: 'api',
port: {{.PORT}},