Skip to content

Commit f060cb4

Browse files
committed
Move config.js to settings.json, makes more sense
1 parent 0239640 commit f060cb4

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jspm_packages
3636
# Optional REPL history
3737
.node_repl_history
3838

39-
config.js
39+
settings.json

config.js.dist

Lines changed: 0 additions & 12 deletions
This file was deleted.

settings.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"sentry": {
3+
"dsn": null
4+
},
5+
"redis": {
6+
"host": null,
7+
"port": null
8+
},
9+
"ftp": {
10+
"host": null,
11+
"user": null,
12+
"password": null
13+
}
14+
}

src/documents/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const config = require('../../config')
1+
const settings = require('../../settings')
22
const electron = require('electron')
33
const fs = require('fs')
44
const FTP = require('ftp')
55
const { parse } = require('@multisolution/multipart-parser')
66
const redisMod = require('redis')
77

88
const { shell } = electron
9-
const redis = redisMod.createClient(config.redis)
9+
const redis = redisMod.createClient(settings.redis)
1010
const webview = document.getElementById('webview')
1111
const ftp = new FTP()
1212

@@ -33,7 +33,7 @@ webview.addEventListener('new-window', event => {
3333
const docJson = data.toString()
3434
const docMeta = JSON.parse(docJson)
3535
const { ext } = docMeta
36-
const downloadUrl = `http://${config.ftp.host}/${docId}.${ext}`
36+
const downloadUrl = `http://${settings.ftp.host}/${docId}.${ext}`
3737

3838
shell.openExternal(downloadUrl)
3939
})
@@ -68,13 +68,13 @@ webview.addEventListener('dom-ready', event => {
6868
const { file } = uploadData[1]
6969

7070
ftp.on('ready', event => {
71-
ftp.put(file, `/var/www/html/${docId}.${ext}`, err => {
71+
ftp.put(file, `${settings.ftp.dest}${docId}.${ext}`, err => {
7272
if (err) throw err
7373
redis.set(docId, JSON.stringify({ ext }))
7474
ftp.end()
7575
})
7676
})
7777

78-
ftp.connect(config.ftp)
78+
ftp.connect(settings.ftp)
7979
})
8080
})

src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const config = require('../config')
1+
const settings = require('../settings')
22

33
const Raven = require('raven')
4-
Raven.config(config.sentryUrl).install();
4+
Raven.config(settings.sentry.dsn).install();
55

66
const { app, BrowserWindow } = require('electron')
77
const path = require('path')

0 commit comments

Comments
 (0)