using env vars for some comfy defaults for development

This commit is contained in:
shockrah 2021-02-12 15:50:05 -08:00
parent 4323156242
commit 6904e8eb26
3 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,10 @@ const cfg = require('./src/config.js')
let win let win
let config = cfg.get_config(cfg.load_parser()) let config = cfg.get_config(cfg.load_parser())
// NOTE: this line is only here for demonstration as the current make script exposes this var
// so that we can test against self signed certificates but still use ssl
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = '0'
function createWin() { function createWin() {
win = new BrowserWindow({ win = new BrowserWindow({
width: 800, width: 800,
@ -23,7 +27,9 @@ function createWin() {
win.loadFile('pages/index.html'); win.loadFile('pages/index.html');
if(process.platform !== 'darwin') { if(process.platform !== 'darwin') {
win.removeMenu(); if(!process.env('DEV_ENV')) {
win.removeMenu()
}
} }
win.on('closed', () => { win.on('closed', () => {
win = null win = null

View File

@ -6,6 +6,9 @@
[[ -z "$1" ]] && echo Options: run \| build && exit 0 [[ -z "$1" ]] && echo Options: run \| build && exit 0
run() { run() {
# Required to tests against the self certs we use in testing envs
export NODE_TLS_REJECT_UNAUTHORIZED=0
export DEV_ENV=true
./node_modules/electron/dist/electron main.js $@ ./node_modules/electron/dist/electron main.js $@
} }

View File

@ -45,8 +45,8 @@ exports.build_server_list = function (config, dom_id) {
'classList': ['btn', 'btn-outline-secondary', 'btn-nav-settings'], 'classList': ['btn', 'btn-outline-secondary', 'btn-nav-settings'],
'textContent': server['name'], 'textContent': server['name'],
'type': 'button', 'type': 'button',
'onClick': channels.get_channels(server)
}) })
child.addEventListener('click', () => channels.get_channels(server))
container.appendChild(child) container.appendChild(child)
} }