Browse Source
Add config option to set connection_string.txt location
master
Graham Krizek
4 years ago
No known key found for this signature in database
GPG Key ID: CE60579CC185BC56
3 changed files with
10 additions and
1 deletions
-
config/app.json
-
src/utils/config.ts
-
src/utils/setup.ts
|
|
@ -15,6 +15,7 @@ |
|
|
|
"media_host": "localhost:5000", |
|
|
|
"tribes_host": "tribes.sphinx.chat", |
|
|
|
"public_url": "", |
|
|
|
"connection_string_path": "connection_string.txt", |
|
|
|
"ssl": { |
|
|
|
"enabled": false, |
|
|
|
"save": true, |
|
|
@ -38,6 +39,7 @@ |
|
|
|
"media_host": "memes.sphinx.chat", |
|
|
|
"tribes_host": "tribes.sphinx.chat", |
|
|
|
"public_url": "", |
|
|
|
"connection_string_path": "connection_string.txt", |
|
|
|
"ssl": { |
|
|
|
"enabled": false, |
|
|
|
"save": true, |
|
|
|
|
|
@ -22,6 +22,7 @@ export function loadConfig() { |
|
|
|
media_host: ENV.MEDIA_HOST || config.media_host, |
|
|
|
tribes_host: ENV.TRIBES_HOST || config.tribes_host, |
|
|
|
public_url: ENV.PUBLIC_URL || config.public_url, |
|
|
|
connection_string_path: ENV.CONNECTION_STRING_PATH || config.connection_string_path, |
|
|
|
ssl: { |
|
|
|
enabled: (ENV.SSL_ENABLED || (config.ssl && config.ssl.enabled)) ? true : false, |
|
|
|
save: (ENV.SSL_SAVE || (config.ssl && config.ssl.save)) ? true : false, |
|
|
|
|
|
@ -6,8 +6,10 @@ import { checkTag, checkCommitHash } from '../utils/gitinfo' |
|
|
|
import * as fs from 'fs'; |
|
|
|
import { isClean } from './nodeinfo' |
|
|
|
import { getQR } from './connect' |
|
|
|
import { loadConfig } from './config' |
|
|
|
|
|
|
|
const USER_VERSION = 7 |
|
|
|
const config = loadConfig() |
|
|
|
|
|
|
|
const setupDatabase = async () => { |
|
|
|
console.log('=> [db] starting setup...') |
|
|
@ -225,7 +227,11 @@ async function printQR() { |
|
|
|
} |
|
|
|
|
|
|
|
function connectionStringFile(str: string) { |
|
|
|
fs.writeFile('connection_string.txt', str, function (err) { |
|
|
|
let connectStringPath = 'connection_string.txt' |
|
|
|
if ('connection_string_path' in config) { |
|
|
|
connectStringPath = config.connection_string_path |
|
|
|
} |
|
|
|
fs.writeFile(connectStringPath, str, function (err) { |
|
|
|
if (err) console.log('ERROR SAVING connection_string.txt.', err); |
|
|
|
}); |
|
|
|
} |