diff --git a/config/app.json b/config/app.json index dd5a6be..82b9783 100644 --- a/config/app.json +++ b/config/app.json @@ -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, diff --git a/src/utils/config.ts b/src/utils/config.ts index a844c2f..55d68b1 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -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, diff --git a/src/utils/setup.ts b/src/utils/setup.ts index 6a9085c..5de4eb6 100644 --- a/src/utils/setup.ts +++ b/src/utils/setup.ts @@ -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); }); } \ No newline at end of file