Skip to content

Commit

Permalink
Added SSL config to teams test app for internal testing (#2366)
Browse files Browse the repository at this point in the history
* Added SSL config to teams test app for internal testing

* clean
  • Loading branch information
Ella-ly authored Jun 24, 2024
1 parent 7453802 commit dc530c3
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion apps/teams-test-app/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/* eslint @typescript-eslint/no-var-requires: off*/

const path = require('path');
const fs = require('fs');

const keyPath = process.env.SSL_KEY_FILE;
const certPath = process.env.SSL_CRT_FILE;
const sslFilesExist = keyPath && certPath && fs.existsSync(keyPath) && fs.existsSync(certPath);
if (sslFilesExist) {
console.log('Using SSL with the following files:');
console.log('SSL_KEY_FILE:', keyPath);
console.log('SSL_CRT_FILE:', certPath);
}

// If the SSL key and certificate files exist, build with SSL options for internal tests.
const serverConfig = {
type: 'https',
...(sslFilesExist && {
options: {
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certPath),
},
}),
};

module.exports = {
mode: 'production',
Expand Down Expand Up @@ -40,7 +61,7 @@ module.exports = {
},
compress: true,
port: 4000,
server: 'https',
server: serverConfig,
allowedHosts: 'all',
},
performance: { hints: false },
Expand Down

0 comments on commit dc530c3

Please sign in to comment.