Kaynağa Gözat

fix: Updated frontend config location usage and check if config attrs exist before using

Owen Diffey 1 yıl önce
ebeveyn
işleme
53312c9e0f

+ 1 - 1
.github/workflows/build-eslint.yml

@@ -32,7 +32,7 @@ jobs:
               run: |
                   cp .env.example .env
                   cp backend/config/template.json backend/config/default.json
-                  cp frontend/config/template.json frontend/config/default.json
+                  cp frontend/dist/config/template.json frontend/dist/config/default.json
                   ./musare.sh build
             - name: Start Musare
               run: ./musare.sh start

+ 1 - 1
.wiki/Installation.md

@@ -53,7 +53,7 @@ Run this command in your shell. You will have to do this command for every shell
 3. [Setup MongoDB](#Setting-up-MongoDB)
 4. [Setup Redis](#Setting-up-Redis)
 5. `cp backend/config/template.json backend/config/default.json` and configure as per [Configuration](./Configuration.md#Backend)
-6. `cp frontend/config/template.json frontend/config/default.json` and configure as per [Configuration](./Configuration.md#Frontend)
+6. `cp frontend/dist/config/template.json frontend/dist/config/default.json` and configure as per [Configuration](./Configuration.md#Frontend)
 7. `cd frontend && npm install && cd ..`
 8. `cd backend && npm install && cd ..`
 9. Start services

+ 1 - 1
frontend/package-lock.json

@@ -8259,4 +8259,4 @@
       "dev": true
     }
   }
-}
+}

+ 6 - 3
frontend/vite.config.js

@@ -22,7 +22,8 @@ const fetchVersionAndGitInfo = () => {
 		);
 
 		console.log(`Musare version: ${packageJson.version}.`);
-		if (config.get("debug.version")) debug.version = packageJson.version;
+		if (config.has("debug.version") && config.get("debug.version"))
+			debug.version = packageJson.version;
 	} catch (e) {
 		console.log(`Could not get package info: ${e.message}.`);
 	}
@@ -125,10 +126,12 @@ let server = null;
 if (mode === "development")
 	server = {
 		host: "0.0.0.0",
-		port: config.get("devServer.port"),
+		port: config.has("devServer.port") ? config.get("devServer.port") : 81,
 		strictPort: true,
 		hmr: {
-			clientPort: config.get("devServer.hmrClientPort")
+			clientPort: config.has("devServer.hmrClientPort")
+				? config.get("devServer.hmrClientPort")
+				: 80
 		}
 	};