Skip to content

Commit f7a9493

Browse files
committed
fix: run with domain configuration
1 parent 543f3ff commit f7a9493

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Create a `.env` file in the root of the project directory and add the necessary
6262
- Description: Used for running E2E tests when authentication is enabled on the backend. This JWT token allows the test runner to authenticate and access the application during testing.
6363
- Example: TESTS_JWT_AUTH_TOKEN=your_jwt_auth_token_for_e2e_tests
6464

65+
`VITE_DISABLE_MKCERT_SSL`
66+
67+
- Default: None (SSL certificates are enabled by default)
68+
- Description: When set to "true", disables automatic SSL certificate generation via mkcert. This forces the development server to use HTTP instead of HTTPS and restricts SSL certificates to localhost only.
69+
- Example: VITE_DISABLE_MKCERT_SSL=true
70+
6571
**Note:** These environment variables are optional. The application will use default values or fall back to certain behaviors if these variables are not set. However, setting them allows for greater customization and functionality, especially in different deployment environments or when running tests.
6672

6773
### Running the Project 🏃

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default defineConfig({
6767
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
6868
use: {
6969
/* Base URL to use in actions like `await page.goto('/')`. */
70-
baseURL: "http://localhost:8000",
70+
baseURL: "https://localhost:8000",
7171

7272
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
7373
trace: "on",

vite.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ export default defineConfig({
8686
include: ["tailwind-config", "apexcharts"],
8787
},
8888
plugins: [
89-
...(process.env.VITE_LOCAL_SSL_CERT === "true" ? [mkcert()] : []),
9089
react(),
90+
mkcert({
91+
hosts:
92+
process.env.VITE_DISABLE_MKCERT_SSL === "true" && process.env.VITE_APP_DOMAIN
93+
? ["localhost"]
94+
: ["localhost", process.env.VITE_APP_DOMAIN].filter(Boolean),
95+
}),
9196
ViteEjsPlugin((viteConfig) => ({
9297
env: viteConfig.env,
9398
})),
@@ -177,7 +182,7 @@ export default defineConfig({
177182
},
178183
},
179184
server: {
180-
host: process.env.VITE_APP_DOMAIN ? JSON.stringify(process.env.VITE_APP_DOMAIN) : true,
185+
host: process.env.VITE_APP_DOMAIN ? "0.0.0.0" : true,
181186
port: process.env.VITE_LOCAL_PORT ? Number(process.env.VITE_LOCAL_PORT) : 8000,
182187
strictPort: true,
183188
},

0 commit comments

Comments
 (0)