File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed
Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ SERVER_PORT=8080
33# Server URL - Set your application url
44SERVER_URL = http://localhost:8080
55
6+ # Paths to your SSL certificate files (used for HTTPS)
7+ SSL_CONF_PRIVKEY = /path/to/cert.key
8+ SSL_CONF_FULLCHAIN = /path/to/cert.crt
9+
610SENTRY_DSN =
711
812# Cors - * for all or set separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
Original file line number Diff line number Diff line change @@ -128,7 +128,15 @@ async function bootstrap() {
128128 const httpServer = configService . get < HttpServer > ( 'SERVER' ) ;
129129
130130 ServerUP . app = app ;
131- const server = ServerUP [ httpServer . TYPE ] ;
131+ let server = ServerUP [ httpServer . TYPE ] ;
132+
133+ if ( server === null ) {
134+ logger . warn ( "SSL cert load failed — falling back to HTTP." )
135+ logger . info ( "Ensure 'SSL_CONF_PRIVKEY' and 'SSL_CONF_FULLCHAIN' env vars point to valid certificate files." ) ;
136+
137+ httpServer . TYPE = "http"
138+ server = ServerUP [ httpServer . TYPE ]
139+ }
132140
133141 eventManager . init ( server ) ;
134142
Original file line number Diff line number Diff line change @@ -12,14 +12,18 @@ export class ServerUP {
1212 }
1313
1414 static get https ( ) {
15- const { FULLCHAIN , PRIVKEY } = configService . get < SslConf > ( 'SSL_CONF' ) ;
16- return https . createServer (
17- {
18- cert : readFileSync ( FULLCHAIN ) ,
19- key : readFileSync ( PRIVKEY ) ,
20- } ,
21- ServerUP . #app,
22- ) ;
15+ try {
16+ const { FULLCHAIN , PRIVKEY } = configService . get < SslConf > ( 'SSL_CONF' ) ;
17+ return https . createServer (
18+ {
19+ cert : readFileSync ( FULLCHAIN ) ,
20+ key : readFileSync ( PRIVKEY ) ,
21+ } ,
22+ ServerUP . #app,
23+ ) ;
24+ } catch {
25+ return null
26+ }
2327 }
2428
2529 static get http ( ) {
You can’t perform that action at this time.
0 commit comments