Make domain name and hosted-by configurable

This commit is contained in:
DeathByDenim 2022-02-14 19:13:57 -05:00
parent dacaad5aba
commit 2aadaf68b3
Signed by: DeathByDenim
GPG Key ID: 4A475283D925365B
9 changed files with 17 additions and 13 deletions

View File

@ -5,7 +5,7 @@
### systems too
###
### Specify domain name:
### DOMAINNAME=example.com ./deploy.sh
### DOMAINNAME=example.com HOSTEDBYNAME=DeathByDenim ./deploy.sh
set -e
@ -13,6 +13,10 @@ if [ -z $DOMAINNAME ]; then
echo "Domain name was not set. Please export DOMAINNAME first"
exit 1
fi
if [ -z $HOSTEDBYNAME ]; then
echo "Hosted-by name was not set. Please export HOSTEDBYNAME first"
exit 1
fi
export stk_version="1.3"
export bzflag_version="2.4"

View File

@ -14,11 +14,11 @@ certbot -n --nginx -d ${DOMAINNAME} -d www.${DOMAINNAME} --agree-tos -m "${letse
# Put the website files in place
cp -r "$(dirname "$0")"/../website/* /var/www/html
for file in $(grep -lR 192.168 /var/www/html/); do
sed -i $file -e s/"ws:\/\/"/"wss:\/\/"/g
for file in /var/www/html/*\.html /var/www/html/js/*\.js; do
sed -i $file -e s/"DOMAINNAME"/"${DOMAINNAME}"/g
done
for file in $(grep -lR 192.168 /var/www/html/); do
sed -i $file -e s/"192\.168\.122\.229"/"${DOMAINNAME}"/g
for file in /var/www/html/*\.html; do
sed -i $file -e s/"HOSTEDBYNAME"/"${HOSTEDBYNAME}"/g
done
# Patch the NGINX configuration for the web sockets

View File

@ -16,7 +16,7 @@
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<img class="bi me-2" width="40" height="32" src="img/blackmage.svg">
<span class="fs-4">Play.jarno.ca</span>
<span class="fs-4">onFOSS-LAN hosted by HOSTEDBYNAME</span>
</a>
<ul class="nav nav-pills">

View File

@ -2,7 +2,7 @@
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Game server</title>
<title>onFOSS-LAN</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/serverstats.css">
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
@ -14,7 +14,7 @@
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<img class="bi me-2" width="40" height="32" src="img/blackmage.svg">
<span class="fs-4">Play.jarno.ca</span>
<span class="fs-4">onFOSS-LAN hosted by HOSTEDBYNAME</span>
</a>
<ul class="nav nav-pills">

View File

@ -14,7 +14,7 @@ function mindustry_init() {
}
// Create WebSocket connection.
const socket = new WebSocket("ws://192.168.122.229/mindustry")
const socket = new WebSocket("wss://DOMAINNAME/mindustry")
// Connection opened
socket.addEventListener('open', function (event) {

View File

@ -14,7 +14,7 @@ function unvanquished_init() {
}
// Create WebSocket connection.
const socket = new WebSocket("ws://192.168.122.229/unvanquished")
const socket = new WebSocket("wss://DOMAINNAME/unvanquished")
// Connection opened
socket.addEventListener('open', function (event) {

View File

@ -14,7 +14,7 @@ function xonotic_init() {
}
// Create WebSocket connection.
const socket = new WebSocket("ws://192.168.122.229/xonotic")
const socket = new WebSocket("wss://DOMAINNAME/xonotic")
// Connection opened
socket.addEventListener('open', function (event) {

View File

@ -11,7 +11,7 @@
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<img class="bi me-2" width="40" height="32" src="img/blackmage.svg">
<span class="fs-4">Play.jarno.ca</span>
<span class="fs-4">onFOSS-LAN hosted by HOSTEDBYNAME</span>
</a>
<ul class="nav nav-pills">

View File

@ -11,7 +11,7 @@
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<img class="bi me-2" width="40" height="32" src="img/blackmage.svg">
<span class="fs-4">Play.jarno.ca</span>
<span class="fs-4">onFOSS-LAN hosted by HOSTEDBYNAME</span>
</a>
<ul class="nav nav-pills">