@@ -4,6 +4,7 @@ import pugPlugin from 'vite-plugin-pug'
44import openapiTS from 'openapi-typescript'
55import { defineNuxtConfig } from 'nuxt/config'
66import { parse } from 'yaml'
7+ import consola from 'consola'
78
89const SESAME_APP_API_URL = process . env . SESAME_APP_API_URL || 'http://localhost:4002'
910
@@ -16,6 +17,19 @@ if (process.env.SESAME_APP_DARK_MODE) {
1617 }
1718}
1819
20+ let https = { }
21+ if ( / y e s | 1 | o n | t r u e / i. test ( `${ process . env . SESAME_HTTPS_ENABLED } ` ) ) {
22+ try {
23+ https = {
24+ key : readFileSync ( `${ process . env . SESAME_HTTPS_PATH_KEY } ` , 'utf8' ) ,
25+ cert : readFileSync ( `${ process . env . SESAME_HTTPS_PATH_CERT } ` , 'utf8' ) ,
26+ } ;
27+ consola . info ( '[Nuxt] SSL certificates loaded successfully' )
28+ } catch ( error ) {
29+ consola . warn ( '[Nuxt] Error while reading SSL certificates' , error )
30+ }
31+ }
32+
1933// https://nuxt.com/docs/api/configuration/nuxt-config
2034export default defineNuxtConfig ( {
2135 ssr : false ,
@@ -25,6 +39,7 @@ export default defineNuxtConfig({
2539 debug : ! ! process . env . DEBUG ,
2640 devServer : {
2741 port : 3000 ,
42+ https,
2843 } ,
2944 devtools : {
3045 enabled : process . env . NODE_ENV === 'development' ,
@@ -106,6 +121,7 @@ export default defineNuxtConfig({
106121 '/api' : {
107122 rewrite : ( path : string ) => path . replace ( / ^ \/ a p i / , '' ) ,
108123 target : SESAME_APP_API_URL ,
124+ secure : false ,
109125 changeOrigin : true ,
110126 }
111127 } ,
0 commit comments