Skip to content

Commit f1186cd

Browse files
committed
add proxy config
1 parent 23ab049 commit f1186cd

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

styleguide.config.proxy.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const path = require('path');
3+
const { createProxyMiddleware } = require('http-proxy-middleware');
4+
5+
module.exports = {
6+
propsParser: require('react-docgen-typescript').withDefaultConfig().parse,
7+
styleguideDir: 'docs-build',
8+
ignore: [
9+
'**/__tests__/**',
10+
'**/tests/**',
11+
'**/*.test.{js,jsx,ts,tsx}',
12+
'**/*.spec.{js,jsx,ts,tsx}',
13+
'**/*.d.ts',
14+
'src/components/index.ts',
15+
],
16+
pagePerSection: true,
17+
sections: [
18+
{
19+
name: 'Introduction',
20+
content: 'README.md',
21+
sectionDepth: 1,
22+
},
23+
{
24+
name: 'Icons',
25+
components: 'src/components/icons/**/*.tsx',
26+
content: 'src/components/icons/README.md',
27+
sectionDepth: 1,
28+
},
29+
{
30+
name: 'Utils',
31+
components: 'src/components/utils/**/*.tsx',
32+
content: 'src/components/utils/README.md',
33+
sectionDepth: 1,
34+
},
35+
{
36+
name: 'Shims',
37+
components: 'src/components/shims/**/*.tsx',
38+
content: 'src/components/shims/README.md',
39+
sectionDepth: 1,
40+
},
41+
],
42+
require: [
43+
path.resolve(__dirname, 'node_modules/@patternfly/patternfly/patternfly.css'),
44+
path.resolve(__dirname, 'node_modules/@patternfly/react-core/dist/styles/base.css'),
45+
],
46+
title: 'KubeVirt UI',
47+
usageMode: 'expand',
48+
webpackConfig: require('./styleguide/webpack.config.js'),
49+
50+
theme: './styleguide/theme.ts',
51+
styles: './styleguide/styles.ts',
52+
53+
styleguideComponents: {
54+
LogoRenderer: path.join(__dirname, 'styleguide/components/Logo'),
55+
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuideRenderer'),
56+
TypeRenderer: path.join(__dirname, 'styleguide/components/Type'),
57+
},
58+
template: {
59+
favicon: './favicon-32x32.png',
60+
},
61+
assetsDir: path.join(__dirname, 'styleguide/assets'),
62+
configureServer(app) {
63+
app.use('/api/kubernetes', createProxyMiddleware({
64+
target: process.env.BRIDGE_CLUSTER_ENDPOINT,
65+
secure: false,
66+
changeOrigin: true,
67+
ws: true,
68+
headers: {Authorization:`Bearer ${process.env.BRIDGE_AUTH_BEARER_TOKEN}`},
69+
pathRewrite: {
70+
[`^/api/kubernetes`]: '',
71+
},
72+
}));
73+
},
74+
};

0 commit comments

Comments
 (0)