Skip to content

Commit

Permalink
Merge pull request #1023 from geoadmin/feat-localhost-ssl
Browse files Browse the repository at this point in the history
Added SSL for the local development server - #minor
  • Loading branch information
ltshb authored Aug 12, 2024
2 parents 4328560 + 0f0f087 commit 1b7564c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
node_modules
dist/
devServer/

# local env files
.env.local
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"preview:dev": "npm run build:dev && vite preview --port 8080 --host --outDir dist/development",
"preview:int": "npm run build:int && vite preview --mode integration --port 8080 --host --outDir dist/integration",
"preview:prod": "npm run build:prod && vite preview --mode production --port 8080 --host --outDir dist/production",
"dev:https": "USE_HTTPS=1 npm run dev",
"int:https": "USE_HTTPS=1 npm run int",
"prod:https": "USE_HTTPS=1 npm run prod",
"preview:dev:https": "USE_HTTPS=1 npm run preview:dev",
"preview:int:https": "USE_HTTPS=1 npm run preview:int",
"preview:prod:https": "USE_HTTPS=1 npm run preview:prod",
"lint": "eslint . --fix --ignore-path .gitignore --ext .js,.vue",
"lint:no-fix": "eslint . --ignore-path .gitignore --ext .js,.vue",
"test:unit": "npm run delete:reports:unit && vitest --run --mode development --environment jsdom",
Expand Down Expand Up @@ -93,6 +99,7 @@
"@rushstack/eslint-patch": "^1.10.4",
"@types/jsdom": "^21.1.7",
"@types/node": "^18.19.43",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"@vitejs/plugin-vue": "^5.1.2",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
Expand Down
14 changes: 14 additions & 0 deletions vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import basicSsl from '@vitejs/plugin-basic-ssl'
import vue from '@vitejs/plugin-vue'
import gitDescribe from 'git-describe'
import { dirname, resolve } from 'path'
Expand Down Expand Up @@ -50,6 +51,19 @@ export default defineConfig(({ mode }) => {
},
},
plugins: [
{
...(process.env.USE_HTTPS
? basicSsl({
/** Name of certification */
name: 'localhost',
/** Custom trust domains */
domains: ['localhost', '192.168.*.*'],
/** Custom certification directory */
certDir: './devServer/cert',
})
: {}),
apply: 'serve',
},
vue({
isProduction: mode === 'production',
template: {
Expand Down

0 comments on commit 1b7564c

Please sign in to comment.