cli: don't coerce args in option store

This commit is contained in:
bordun 2020-03-29 15:05:52 +02:00
parent d295b8e646
commit fa182276fe
3 changed files with 14 additions and 20 deletions

View file

@ -15,6 +15,16 @@ var urlparser = require('url'),
clients = {},
httpCheckTimeout
var clientOptions = {}
if (settings.read('client-options')) {
for (var o of settings.read('client-options')) {
if (!o.includes('=')) continue
var [k, v] = o.split('=')
clientOptions[k] = v
}
}
function httpRoute(req, res) {
res.sendFile = (path)=>{
@ -30,7 +40,7 @@ function httpRoute(req, res) {
fs.createReadStream(path.resolve(__dirname + '/../client/index.html'))
.pipe(replaceStream('</body>', `
<script>
window.ENV=${JSON.stringify(settings.read('client-options'))}
window.ENV=${JSON.stringify(clientOptions)}
window.READ_ONLY=${JSON.stringify(settings.read('read-only'))}
</script></body>`))
.pipe(res)