Browse Source

Merge pull request #137 from gkrizek/voltage

Add config option to set connection_string.txt location
master
Evan Feenstra 4 years ago
committed by GitHub
parent
commit
e2abe69de5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      config/app.json
  2. 1
      src/utils/config.ts
  3. 8
      src/utils/setup.ts

2
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,

1
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,

8
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);
});
}
Loading…
Cancel
Save