new(all): SSR enabled for test in PROD.

This commit is contained in:
Rodrigo Rodriguez 2022-02-20 18:49:32 -03:00
parent b5d99c3fa4
commit 02898ad898
3 changed files with 28 additions and 15 deletions

View file

@ -156,6 +156,17 @@ export class GBMinService {
// default.gbui access definition. // default.gbui access definition.
GBServer.globals.server.use('/', express.static(url)); GBServer.globals.server.use('/', express.static(url));
GBServer.globals.server.use('/ssr-delay', async (req,res) => {
const sleep = async ms => {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
await sleep(10000);
res.status(200);
res.end();
});
} }
// Servers the bot information object via HTTP so clients can get // Servers the bot information object via HTTP so clients can get

View file

@ -38,6 +38,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="shortcut icon" href="%PUBLIC_URL%/ssrdelay">
<link rel="stylesheet" type="text/css" href="./css/pragmatismo.css" /> <link rel="stylesheet" type="text/css" href="./css/pragmatismo.css" />
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script> <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<title>General Bots Community Edition | pragmatismo.io</title> <title>General Bots Community Edition | pragmatismo.io</title>

View file

@ -212,20 +212,20 @@ export class GBServer {
}; };
if (process.env.CERTIFICATE_PFX) { if (process.env.CERTIFICATE_PFX) {
var options = { var options = {
passphrase: process.env.CERTIFICATE_PASSPHRASE , passphrase: process.env.CERTIFICATE_PASSPHRASE,
pfx: fs.readFileSync(process.env.CERTIFICATE_PFX) pfx: fs.readFileSync(process.env.CERTIFICATE_PFX)
}; };
};
const httpsServer = https.createServer(options, server).listen(port, mainCallback); const httpsServer = https.createServer(options, server).listen(port, mainCallback);
if (process.env.CERTIFICATE2_PFX) { if (process.env.CERTIFICATE2_PFX) {
var options = { var options = {
passphrase: process.env.CERTIFICATE2_PASSPHRASE , passphrase: process.env.CERTIFICATE2_PASSPHRASE,
pfx: fs.readFileSync(process.env.CERTIFICATE2_PFX) pfx: fs.readFileSync(process.env.CERTIFICATE2_PFX)
}; };
httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options); httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options);
} }
}
else { else {
server.listen(port, mainCallback); server.listen(port, mainCallback);
} }