Changement de TOUTES les occurrences d'un host ou d'un port écrits en dur dans le projet.

This commit is contained in:
batche
2023-01-03 13:47:37 +01:00
parent 387e2f60b6
commit 5150990d6f
7 changed files with 98 additions and 41 deletions

View File

@@ -38,6 +38,8 @@ services:
dockerfile: Dockerfile
environment:
NODE_ENV: "${NODE_ENV}"
WEBSITE_HOST: "${WEBSITE_HOST}"
WEBSITE_PORT: "${WEBSITE_PORT}"
restart: unless-stopped
ports:
- "8042:8042"

View File

@@ -37,10 +37,10 @@ export class AuthenticationController {
const user : User = request.user
if (user.isEnabledTwoFactorAuth === false || user.isTwoFactorAuthenticated === true){
console.log('ON VA VERS PROFILE');
return response.status(200).redirect('http://transcendance:8080/#/profile');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/profile');
}
console.log('ON VA VERS 2FA')
return response.status(200).redirect('http://transcendance:8080/#/2fa');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/2fa');
}
/**
@@ -83,6 +83,6 @@ export class AuthenticationController {
throw new UnauthorizedException('Wrong Code.');
await this.userService.authenticateUserWith2FA(request.user.id);
console.log('ON REDIRIGE');
return response.status(200).redirect('http://transcendance:8080/#/profile');
return response.status(200).redirect('http://' + process.env.WEBSITE_HOST + ':' + process.env.WEBSITE_PORT + '/#/profile');
}
}

View File

@@ -1,8 +1,7 @@
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name transcendance;
listen 8080;
listen [::]:8080;
server_name localhost;
location /api/v2 {
proxy_set_header Host $host;
@@ -17,7 +16,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "Upgrade";
proxy_pass http://backend_dev:5000/chat;
}
@@ -43,10 +42,9 @@ server {
}
server {
listen 35729 default_server;
listen [::]:35729 default_server;
server_name transcendance;
server_name localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View File

@@ -3,10 +3,10 @@ import * as c from "./constants.js"
// export const soundPongArr: HTMLAudioElement[] = [];
export const soundPongArr: HTMLAudioElement[] = [
new Audio("http://transcendance:8080/sound/pong/"+1+".ogg"),
new Audio("http://transcendance:8080/sound/pong/"+2+".ogg")
new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/pong/"+1+".ogg"),
new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/pong/"+2+".ogg")
];
export const soundRoblox = new Audio("http://transcendance:8080/sound/roblox-oof.ogg");
export const soundRoblox = new Audio("http://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/sound/roblox-oof.ogg");
export function initAudio(sound: string)
{
@@ -18,11 +18,6 @@ export function initAudio(sound: string)
muteFlag = true;
}
/* for (let i = 0; i <= 32; i++) {
soundPongArr.push(new Audio("http://transcendance:8080/sound/pong/"+i+".ogg"));
soundPongArr[i].volume = c.soundPongVolume;
soundPongArr[i].muted = muteFlag;
} */
soundPongArr.forEach((value) => {
value.volume = c.soundRobloxVolume;
value.muted = muteFlag;

View File

@@ -35,7 +35,7 @@ class ClientInfoSpectator {
playerRightNextPos: VectorInteger;
}
const wsUrl = "ws://transcendance:8080/pong";
const wsUrl = "ws://" + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + "/pong";
export let socket: WebSocket; /* TODO: A way to still use "const" not "let" ? */
export const clientInfo = new ClientInfo();
export const clientInfoSpectator = new ClientInfoSpectator(); // WIP, could refactor this

View File

@@ -21,7 +21,7 @@ export const primaryRoutes = {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + '/api/v2/user')
.then((resp) => resp.json())
console.log('in /profile what is in user')
@@ -38,7 +38,7 @@ export const primaryRoutes = {
component: ProfilePage,
conditions: [
async(detail) => {
const user = await fetch('http://transcendance:8080/api/v2/user')
const user = await fetch('http://' + process.env.WEBSITE_HOST + ":" + process.env.WEBSITE_PORT + '/api/v2/user')
.then((resp) => resp.json())
console.log('in /profile/* what is in user')