[web-src] Allow the dev server to run against a remote forked-daapd instance

This commit is contained in:
chme 2020-05-02 08:43:10 +02:00
parent 4188a54e37
commit 341acca184
3 changed files with 12 additions and 4 deletions

2
web-src/.env.development Normal file
View File

@ -0,0 +1,2 @@
VUE_APP_JSON_API_SERVER='http://localhost:3689'
VUE_APP_WEBSOCKET_SERVER='ws://localhost:3688'

View File

@ -111,8 +111,14 @@ export default {
protocol = 'wss://' protocol = 'wss://'
} }
var wsUrl = protocol + window.location.hostname + ':' + vm.$store.state.config.websocket_port
if (process.env.NODE_ENV === 'development' && process.env.VUE_APP_WEBSOCKET_SERVER) {
// If we are running in the development server, use the websocket url configured in .env.development
wsUrl = process.env.VUE_APP_WEBSOCKET_SERVER
}
var socket = new ReconnectingWebSocket( var socket = new ReconnectingWebSocket(
protocol + window.location.hostname + ':' + vm.$store.state.config.websocket_port, wsUrl,
'notify', 'notify',
{ reconnectInterval: 3000 } { reconnectInterval: 3000 }
) )

View File

@ -24,13 +24,13 @@ module.exports = {
// localhost:3689 // localhost:3689
proxy: { proxy: {
'/api': { '/api': {
target: 'http://localhost:3689' target: process.env.VUE_APP_JSON_API_SERVER
}, },
'/artwork': { '/artwork': {
target: 'http://localhost:3689' target: process.env.VUE_APP_JSON_API_SERVER
}, },
'/stream.mp3': { '/stream.mp3': {
target: 'http://localhost:3689' target: process.env.VUE_APP_JSON_API_SERVER
} }
} }
} }