Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit 46f15d3

Browse files
author
antblood
committed
feat: added support freezing
1 parent 9a2ec38 commit 46f15d3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/commands/freeze.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {BaseCommand} from '../lib'
2+
3+
const MUTATION = `mutation { freeze }`
4+
5+
export default class Freeze extends BaseCommand {
6+
static description = 'Freeze your backend.'
7+
static hidden = true
8+
static examples = [
9+
'$ slash-graphql freeze -e https://frozen-mango.cloud.dgraph.io/graphql -t <apiToken>',
10+
'$ slash-graphql freeze -e 0x42',
11+
]
12+
13+
static flags = {
14+
...BaseCommand.commonFlags,
15+
...BaseCommand.endpointFlags,
16+
}
17+
18+
async run() {
19+
const opts = this.parse(Freeze)
20+
const backend = await this.backendFromOpts(opts)
21+
const {errors} = await backend.slashAdminQuery<{freeze: any}>(MUTATION)
22+
if (errors) {
23+
for (const {message} of errors) {
24+
this.error(message)
25+
}
26+
return
27+
}
28+
if (!opts.flags.quiet) {
29+
this.log('Successfully froze backend')
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)