mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Signed-off-by: Jorge Lobo <jlobo@opennebula.io> Co-authored-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
parent
a0c3aa981b
commit
e39644629a
@ -15,7 +15,7 @@ import {
|
||||
} from 'fs-extra'
|
||||
import http from 'http'
|
||||
import https from 'https'
|
||||
import { defaultTypeLog, defaultPort, defaultWebpackMode } from './utils/constants/defaults'
|
||||
import { defaultTypeLog, defaultPort, defaultWebpackMode, defaultApps } from './utils/constants/defaults'
|
||||
import {
|
||||
validateServerIsSecure,
|
||||
getCert,
|
||||
@ -109,9 +109,12 @@ app.use(bodyParser.urlencoded({ extended: false }))
|
||||
app.use(bodyParser.json())
|
||||
|
||||
app.use('/api', entrypointApi) // opennebula Api routes
|
||||
app.get('/provision', entrypointApp)
|
||||
app.get('/fireedge', entrypointApp)
|
||||
app.get('/', (req, res) => res.send('index'))
|
||||
const frontApps = Object.keys(defaultApps)
|
||||
frontApps.map(frontApp => {
|
||||
app.get(`/${frontApp}`, entrypointApp)
|
||||
app.get(`/${frontApp}/*`, entrypointApp)
|
||||
})
|
||||
app.get('/*', (req, res) => res.send('index'))
|
||||
// 404 - public
|
||||
app.get('*', entrypoint404)
|
||||
|
||||
|
@ -33,7 +33,7 @@ router.get('*', (req, res) => {
|
||||
let storeRender = ''
|
||||
let chunks = ''
|
||||
if (env.NODE_ENV === 'production') {
|
||||
app = req.url.replace(/\//g, '')
|
||||
app = req.url.split(/\//gi).filter(sub => sub && sub.length > 0)[0]
|
||||
chunks = `<script src='/client/1.bundle.${app}.js'></script>`
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,17 @@
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
const apps = {
|
||||
fireedge: {
|
||||
assets: true
|
||||
},
|
||||
provision: undefined
|
||||
}
|
||||
const default2FAOpennebulaVar = 'TWO_FACTOR_AUTH_SECRET'
|
||||
const defaultIp = '127.0.0.1'
|
||||
const protocol = 'http'
|
||||
const defaults = {
|
||||
defaultApps: apps,
|
||||
httpMethod: {
|
||||
GET: 'GET',
|
||||
POST: 'POST',
|
||||
|
@ -8,7 +8,8 @@ const js = {
|
||||
include: path.resolve(__dirname, 'src', 'client')
|
||||
}
|
||||
|
||||
const bundle = ({ name = 'fireedge' } = {}) => {
|
||||
const bundle = () => {
|
||||
const devPathFile = path.resolve(__dirname, 'src', 'client', 'dev.js')
|
||||
const plugins = [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
@ -21,11 +22,11 @@ const bundle = ({ name = 'fireedge' } = {}) => {
|
||||
mode: defaultWebpackMode,
|
||||
entry: [
|
||||
'webpack-hot-middleware/client',
|
||||
path.resolve(__dirname, 'src', 'client', 'dev.js')
|
||||
devPathFile
|
||||
],
|
||||
target: 'web',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'src', 'client', 'dev.js'),
|
||||
path: devPathFile,
|
||||
filename: 'bundle.dev.js',
|
||||
publicPath: '/client'
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const CopyPlugin = require('copy-webpack-plugin')
|
||||
const { defaultApps } = require('./src/server/utils/constants/defaults')
|
||||
|
||||
const js = {
|
||||
test: /\.js$/,
|
||||
@ -41,4 +42,6 @@ const bundle = ({ assets = false, name = 'fireedge' }) => {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = [bundle({ assets: true }), bundle({ name: 'provision' })]
|
||||
module.exports = () => Object.entries(defaultApps).map(([key, values]) =>
|
||||
bundle({ ...values, name: key })
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user