Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated webpack to use wevotedeveloper.com SSL if configured #3836

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions serverWevotedeveloper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable */

// start the express server

// invoke:
// node serverWevotedeveloper.js

const express = require("express");
const app = express();
const fs = require("fs");
const https = require("https");
const path = require("path");
const webAppConfig = require("./src/js/config");

const port = 3000;
const opts = { redirect: true };
const hostname = "wevotedeveloper.com";

app.use("/", express.static("build", opts));
app.all("*", (req, res) => res.sendFile(__dirname + "/build/index.html"));

const certOptions = {
key: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com_key.txt")),
cert: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com.crt")),
};

const server = https.createServer(certOptions, app).listen(port, function () {
console.log("INFO: https server started", new Date());
console.log(`INFO: Server is at https://${hostname}:${port}`);
});
12 changes: 12 additions & 0 deletions src/js/components/Widgets/StorybookRedirect.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { renderLog } from '../../common/utils/logging';


// React functional component example
export default function StorybookRedirect () {
renderLog('StorybookRedirect functional component');

return (
<a href="/storybook?path=/docs/design-system--docs">Redirect to Html page</a>
);
}
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if (major < 13) {
} else {
console.log(`Node version is: ${process.version}`);
}
console.log('useRealCerts in webpack.config.js ', useRealCerts);
// console.log('key: ', fs.readFileSync(`./${source}/cert/wevotedeveloper.com.crt`).toString());

module.exports = (env, argv) => ({
entry: path.resolve(__dirname, `./${source}/index.jsx`),
Expand Down Expand Up @@ -166,7 +168,7 @@ module.exports = (env, argv) => ({
static: {
directory: path.join(__dirname, './build'),
},
host: 'localhost',
host: (useRealCerts ? 'wevotedeveloper.com' : 'localhost'),
port,
historyApiFallback: true,
// open: true,
Expand Down
Loading