forked from fauna/fauna-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault-endpoint.js
More file actions
31 lines (25 loc) · 790 Bytes
/
default-endpoint.js
File metadata and controls
31 lines (25 loc) · 790 Bytes
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
const { setDefaultEndpoint, errorOut } = require('../lib/misc.js')
const FaunaCommand = require('../lib/fauna-command.js')
class DefaultEndpointCommand extends FaunaCommand {
async run() {
return setDefaultEndpoint(this.args.endpoint_alias)
.then(this.log)
.catch(function (err) {
errorOut(err.message, 1)
})
}
}
DefaultEndpointCommand.description = `
Sets an endpoint as the default one
`
DefaultEndpointCommand.examples = ['$ fauna default-endpoint endpoint']
// clear the default FaunaCommand flags that accept --host, --port, etc.
DefaultEndpointCommand.flags = {}
DefaultEndpointCommand.args = [
{
name: 'endpoint_alias',
required: true,
description: 'FaunaDB server endpoint alias',
},
]
module.exports = DefaultEndpointCommand