diff --git a/client/src/socket.jsx b/client/src/socket.jsx index f6b80c90..4edccc85 100755 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -3,6 +3,8 @@ const cbor = require('borc'); const actions = require('./actions'); +const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'ws://cryps.gg:40000' : 'ws://localhost:40000'; + function errorToast(err) { console.error(err); return toast({ @@ -21,7 +23,7 @@ function createSocket(store) { let gameStateTimeout; function connect() { - ws = new WebSocket('ws://localhost:40000'); + ws = new WebSocket(SOCKET_URL); ws.binaryType = 'arraybuffer'; // Connection opened diff --git a/ops/init_db.sh b/ops/init_db.sh index 1c1fabd1..4ba8581c 100755 --- a/ops/init_db.sh +++ b/ops/init_db.sh @@ -1,11 +1,11 @@ #!/bin/bash -sudo apt-get install -y postgresql postgresql-contrib +# sudo apt-get install -y postgresql postgresql-contrib sudo service postgresql start sudo -u postgres dropdb cryps sudo -u postgres createdb cryps -sudo -u postgres echo "craftbeer" > /var/lib/postgres/.pgpass sudo -u postgres createuser --encrypted cryps +sudo -u postgres psql -c "alter user cryps with encrypted password 'craftbeer';" npm i npm run migrate