1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 23:30:05 +02:00
copilot/packages/portal-api/bootstrap-data.js

37 lines
757 B
JavaScript
Raw Normal View History

2017-05-03 22:48:15 +03:00
'use strict';
2017-06-05 23:54:44 +03:00
const Data = require('portal-data');
2017-05-03 22:48:15 +03:00
const data = new Data();
2017-06-05 23:54:44 +03:00
const ifError = function (err) {
if (err) {
console.error(err);
process.exit(1);
}
};
2017-05-03 22:48:15 +03:00
data.connect(() => {
2017-06-05 23:54:44 +03:00
data.createDatacenter({ region: 'us-sw', name: 'us-sw' }, (err, datacenter) => {
ifError(err);
data.createUser({ firstName: 'Nikola', lastName: 'Tesla', email: 'nikola@tesla.com', login: 'nikola' }, (err, user) => {
ifError(err);
data.createPortal({
user,
datacenter
}, (err, portal) => {
ifError(err);
data.createDeploymentGroup({ name: 'test' }, (err) => {
ifError(err);
console.log('data bootstrapped');
process.exit(0);
});
});
2017-05-03 22:48:15 +03:00
});
});
});