From 6ba4c1b84341a405a4e13b9618a0d99d145f077e Mon Sep 17 00:00:00 2001
From: Dennis Postma <dennis@directonline.io>
Date: Fri, 7 Feb 2025 01:14:57 +0100
Subject: [PATCH] Updated Dockerfile, renamed config key

---
 .env.example                                         |  2 +-
 Dockerfile                                           | 12 ++++++------
 src/application/config.ts                            |  2 +-
 .../partials/mapObject/MapObjectList.vue             |  2 +-
 .../assetManager/partials/sprite/SpriteList.vue      |  2 +-
 .../assetManager/partials/tile/TileList.vue          |  2 +-
 src/stores/gameStore.ts                              |  2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.env.example b/.env.example
index 1fa7302..0a2db3a 100644
--- a/.env.example
+++ b/.env.example
@@ -1,5 +1,5 @@
 VITE_NAME=Noxious
-VITE_DEVELOPMENT=true
+VITE_ENVIRONMENT=development
 VITE_SERVER_ENDPOINT=http://localhost:4000
 VITE_TILE_SIZE_WIDTH=64
 VITE_TILE_SIZE_HEIGHT=32
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index add8bcf..d8a21df 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,17 +9,17 @@ COPY . .
 ARG VITE_NAME=${VITE_NAME}
 ENV VITE_NAME=${VITE_NAME}
 
-ARG VITE_DEVELOPMENT=${VITE_DEVELOPMENT}
-ENV VITE_DEVELOPMENT=${VITE_DEVELOPMENT}
+ARG VITE_ENVIRONMENT=${VITE_ENVIRONMENT}
+ENV VITE_ENVIRONMENT=${VITE_ENVIRONMENT}
 
 ARG VITE_SERVER_ENDPOINT=${VITE_SERVER_ENDPOINT}
 ENV VITE_SERVER_ENDPOINT=${VITE_SERVER_ENDPOINT}
 
-ARG VITE_TILE_SIZE_X=${VITE_TILE_SIZE_X}
-ENV VITE_TILE_SIZE_X=${VITE_TILE_SIZE_X}
+ARG VITE_TILE_SIZE_WIDTH=${VITE_TILE_SIZE_WIDTH}
+ENV VITE_TILE_SIZE_WIDTH=${VITE_TILE_SIZE_WIDTH}
 
-ARG VITE_TILE_SIZE_Y=${VITE_TILE_SIZE_Y}
-ENV VITE_TILE_SIZE_Y=${VITE_TILE_SIZE_Y}
+ARG VITE_TILE_SIZE_HEIGHT=${VITE_TILE_SIZE_HEIGHT}
+ENV VITE_TILE_SIZE_HEIGHT=${VITE_TILE_SIZE_HEIGHT}
 
 # Build the application
 RUN npm run build-ntc
diff --git a/src/application/config.ts b/src/application/config.ts
index 71cfd55..62884cf 100644
--- a/src/application/config.ts
+++ b/src/application/config.ts
@@ -1,6 +1,6 @@
 export default {
   name: import.meta.env.VITE_NAME,
-  development: import.meta.env.VITE_DEVELOPMENT === 'true',
+  environment: import.meta.env.VITE_ENVIRONMENT,
   server_endpoint: import.meta.env.VITE_SERVER_ENDPOINT,
   tile_size: {
     width: Number(import.meta.env.VITE_TILE_SIZE_WIDTH),
diff --git a/src/components/gameMaster/assetManager/partials/mapObject/MapObjectList.vue b/src/components/gameMaster/assetManager/partials/mapObject/MapObjectList.vue
index 0b0470e..38ec6df 100644
--- a/src/components/gameMaster/assetManager/partials/mapObject/MapObjectList.vue
+++ b/src/components/gameMaster/assetManager/partials/mapObject/MapObjectList.vue
@@ -49,7 +49,7 @@ const handleFileUpload = (e: Event) => {
   if (!files) return
   gameStore.connection?.emit('gm:mapObject:upload', files, (response: boolean) => {
     if (!response) {
-      if (config.development) console.error('Failed to upload object')
+      if (config.environment === 'development') console.error('Failed to upload map object')
       return
     }
 
diff --git a/src/components/gameMaster/assetManager/partials/sprite/SpriteList.vue b/src/components/gameMaster/assetManager/partials/sprite/SpriteList.vue
index abc9de9..5cfa03d 100644
--- a/src/components/gameMaster/assetManager/partials/sprite/SpriteList.vue
+++ b/src/components/gameMaster/assetManager/partials/sprite/SpriteList.vue
@@ -42,7 +42,7 @@ const elementToScroll = ref()
 function newButtonClickHandler() {
   gameStore.connection?.emit('gm:sprite:create', {}, (response: boolean) => {
     if (!response) {
-      if (config.development) console.error('Failed to create new sprite')
+      if (config.environment === 'development') console.error('Failed to create new sprite')
       return
     }
 
diff --git a/src/components/gameMaster/assetManager/partials/tile/TileList.vue b/src/components/gameMaster/assetManager/partials/tile/TileList.vue
index c7262e3..cd1ab2b 100644
--- a/src/components/gameMaster/assetManager/partials/tile/TileList.vue
+++ b/src/components/gameMaster/assetManager/partials/tile/TileList.vue
@@ -49,7 +49,7 @@ const handleFileUpload = (e: Event) => {
   if (!files) return
   gameStore.connection?.emit('gm:tile:upload', files, (response: boolean) => {
     if (!response) {
-      if (config.development) console.error('Failed to upload tile')
+      if (config.environment === 'development') console.error('Failed to upload tile')
       return
     }
 
diff --git a/src/stores/gameStore.ts b/src/stores/gameStore.ts
index fbe9149..f807a16 100644
--- a/src/stores/gameStore.ts
+++ b/src/stores/gameStore.ts
@@ -74,7 +74,7 @@ export const useGameStore = defineStore('game', {
     },
     initConnection() {
       this.connection = io(config.server_endpoint, {
-        secure: !config.development,
+        secure: !config.environment.includes('development'),
         withCredentials: true,
         transports: ['websocket'],
         reconnectionAttempts: 5