(log, callback)
| 28 | const pushEndpoint = `${pushEndpointRoot}/api/v1/instance`; |
| 29 | |
| 30 | function initManagementDatabase(log, callback) { |
| 31 | // XXX choose proper owner names |
| 32 | const md = new arsenal.models.BucketInfo(managementDatabaseName, 'owner', |
| 33 | 'owner display name', new Date().toJSON()); |
| 34 | |
| 35 | metadata.createBucket(managementDatabaseName, md, log, error => { |
| 36 | if (error) { |
| 37 | if (error.is.BucketAlreadyExists) { |
| 38 | log.info('created management database'); |
| 39 | return callback(); |
| 40 | } |
| 41 | log.error('could not initialize management database', |
| 42 | { error: reshapeExceptionError(error), |
| 43 | method: 'initManagementDatabase' }); |
| 44 | return callback(error); |
| 45 | } |
| 46 | log.info('initialized management database'); |
| 47 | return callback(); |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | function startManagementListeners(instanceId, token) { |
| 52 | const mode = process.env.MANAGEMENT_MODE || 'push'; |
no test coverage detected