Skip to content

Commit

Permalink
Add option to run dev server using TLS
Browse files Browse the repository at this point in the history
This PR introduces the env variable `TLS_DEV_SERVER` that
can be set to `1` to enable the dev server serving content
using tls.
  • Loading branch information
Frederik Rothenberger committed Oct 26, 2023
1 parent bcf5bfa commit a747966
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@types/ua-parser-js": "^0.7.36",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"@vitejs/plugin-basic-ssl": "^1.0.1",
"@wdio/globals": "^8.6.9",
"astro": "^2.4.1",
"eslint": "8.51.0",
Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import basicSsl from "@vitejs/plugin-basic-ssl";
import { resolve } from "path";
import { AliasOptions, defineConfig, UserConfig } from "vite";
import {
Expand Down Expand Up @@ -58,6 +59,7 @@ export default defineConfig(({ mode }: UserConfig): UserConfig => {
plugins: [
[...(mode === "development" ? [injectCanisterIdPlugin()] : [])],
[...(mode === "production" ? [minifyHTML(), compression()] : [])],
[...(process.env.TLS_DEV_SERVER === "1" ? [basicSsl()] : [])],
],
optimizeDeps: {
esbuildOptions: {
Expand All @@ -67,6 +69,7 @@ export default defineConfig(({ mode }: UserConfig): UserConfig => {
},
},
server: {
https: process.env.TLS_DEV_SERVER === "1",
proxy: {
"/api": "http://127.0.0.1:4943",
},
Expand Down

0 comments on commit a747966

Please sign in to comment.