-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
56 lines (53 loc) · 1.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var commandHandlers = require('./command-handlers');
var validate = require('./validate');
module.exports = {
name: 'chromadb',
description: 'Commands to setup and manage Chromadb',
commands: {
setup: {
description: 'Installs and starts Chromadb',
handler: commandHandlers.setup
},
logs: {
description: 'View Chromadb logs',
builder: function(yargs) {
return yargs.strict(false);
},
handler: commandHandlers.logs
},
start: {
description: 'Start Chromadb',
handler: commandHandlers.start
},
stop: {
description: 'Stop Chromadb',
handler: commandHandlers.stop
}
},
validate: {
chromadb: validate
},
prepareConfig: function(config) {
if (config.app && config.chromadb) {
if (!config.app.docker) {
config.app.docker = {};
}
if (!config.app.docker.args) {
config.app.docker.args = [];
}
config.app.docker.args.push('--link=chromadb:chromadb');
config.app.docker.args.push('--env=CHROMA_DB_URL=http://chromadb:8000');
}
},
hooks: {
'post.setup': function(api) {
if (!api.getConfig().chromadb) {
return;
}
return api.runCommand('chromadb.setup')
.then(function() {
return api.runCommand('chromadb.start');
});
}
}
};