Skip to content

Commit

Permalink
chore(defaults): added Installation ID
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Apr 30, 2019
1 parent 3d12667 commit 59e7b01
Showing 1 changed file with 20 additions and 32 deletions.
52 changes: 20 additions & 32 deletions src/settings/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,6 @@ settingsDefaults.adminGrants = [
'api:*'
]

function teamsDefault (callback) {
var teamSchema = require('../models/team')
var roleSchmea = require('../models/role')
var userSchema = require('../models/user')

async.series(
[
function (next) {
// Create default Support Team
}
],
callback
)

teamSchema.create(
{
name: 'Support'
},
function (err, team) {
if (err) console.log(err)

teamSchema.getTeams(function (err, teams) {
if (err) return callback(err)

console.log(teams)

return callback()
})
}
)
}

function rolesDefault (callback) {
var roleSchema = require('../models/role')

Expand Down Expand Up @@ -680,6 +648,23 @@ function elasticSearchConfToDB (callback) {
)
}

function installationID (callback) {
var Chance = require('chance')
var chance = new Chance()
SettingsSchema.getSettingByName('gen:installid', function (err, setting) {
if (err) return callback(err)
if (!setting) {
SettingsSchema.create(
{
name: 'gen:installid',
value: chance.guid()
},
callback
)
}
})
}

settingsDefaults.init = function (callback) {
winston.debug('Checking Default Settings...')
async.series(
Expand Down Expand Up @@ -722,6 +707,9 @@ settingsDefaults.init = function (callback) {
},
function (done) {
elasticSearchConfToDB(done)
},
function (done) {
installationID(done)
}
],
function (err) {
Expand Down

0 comments on commit 59e7b01

Please sign in to comment.