aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/cli.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-02 14:09:33 +0200
committerChocobozzz <me@florianbigard.com>2020-04-02 14:09:33 +0200
commit3d3bb23816881167dd48f910862d7f5503d50460 (patch)
tree2ed32a94269ec329173ddd8f925a04e2ade9bb6e /server/tools/cli.ts
parent4fd98756e246a8fd5818580cf09f0ba5f78a48fa (diff)
downloadPeerTube-3d3bb23816881167dd48f910862d7f5503d50460.tar.gz
PeerTube-3d3bb23816881167dd48f910862d7f5503d50460.tar.zst
PeerTube-3d3bb23816881167dd48f910862d7f5503d50460.zip
Update CLI dependencies
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r--server/tools/cli.ts39
1 files changed, 12 insertions, 27 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts
index 7658eddce..ca05dab92 100644
--- a/server/tools/cli.ts
+++ b/server/tools/cli.ts
@@ -35,19 +35,17 @@ interface Settings {
35 default: number 35 default: number
36} 36}
37 37
38function getSettings () { 38async function getSettings (): Promise<Settings> {
39 return new Promise<Settings>((res, rej) => { 39 const defaultSettings = {
40 const defaultSettings = { 40 remotes: [],
41 remotes: [], 41 default: -1
42 default: -1 42 }
43 }
44 43
45 config.read((err, data) => { 44 const data = await config.read()
46 if (err) return rej(err)
47 45
48 return res(Object.keys(data).length === 0 ? defaultSettings : data) 46 return Object.keys(data).length === 0
49 }) 47 ? defaultSettings
50 }) 48 : data
51} 49}
52 50
53async function getNetrc () { 51async function getNetrc () {
@@ -62,24 +60,12 @@ async function getNetrc () {
62 return netrc 60 return netrc
63} 61}
64 62
65function writeSettings (settings) { 63function writeSettings (settings: Settings) {
66 return new Promise((res, rej) => { 64 return config.write(settings)
67 config.write(settings, err => {
68 if (err) return rej(err)
69
70 return res()
71 })
72 })
73} 65}
74 66
75function deleteSettings () { 67function deleteSettings () {
76 return new Promise((res, rej) => { 68 return config.trash()
77 config.trash((err) => {
78 if (err) return rej(err)
79
80 return res()
81 })
82 })
83} 69}
84 70
85function getRemoteObjectOrDie ( 71function getRemoteObjectOrDie (
@@ -227,7 +213,6 @@ function getLogger (logLevel = 'info') {
227 213
228export { 214export {
229 version, 215 version,
230 config,
231 getLogger, 216 getLogger,
232 getSettings, 217 getSettings,
233 getNetrc, 218 getNetrc,