Skip to content

Commit 38bedd0

Browse files
Impl [Infrastructure] Integrating IGZ-4 via Module Federation (#447)
1 parent 230817e commit 38bedd0

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

eslint.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
/* global process */
12
import eslintConfigPrettier from 'eslint-config-prettier'
23
import globals from 'globals'
34
import js from '@eslint/js'
45
import react from 'eslint-plugin-react'
56
import reactHooks from 'eslint-plugin-react-hooks'
67

8+
import { viteGlobals } from './eslint.mlrun-globals.mjs'
9+
710
export default [
811
{ ignores: ['dist'] },
912
js.configs.recommended,
@@ -12,7 +15,7 @@ export default [
1215
files: ['**/*.{js,jsx,ts,tsx}'],
1316
languageOptions: {
1417
ecmaVersion: 2021,
15-
globals: globals.browser,
18+
globals: { ...globals.browser, ...viteGlobals },
1619
parserOptions: {
1720
ecmaFeatures: {
1821
jsx: true

eslint.mlrun-globals.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const viteGlobals = {
2+
VITE_PUBLIC_URL: 'readonly',
3+
VITE_MLRUN_API_URL: 'readonly',
4+
VITE_NUCLIO_API_URL: 'readonly',
5+
VITE_IGUAZIO_API_URL: 'readonly',
6+
VITE_FUNCTION_CATALOG_URL: 'readonly',
7+
VITE_MLRUN_V3IO_ACCESS_KEY: 'readonly',
8+
VITE_FEDERATION: 'readonly'
9+
}

src/lib/utils/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ such restriction.
1717

1818
export * as chips from './chips.util'
1919
export * as common from './common.util'
20+
export * as createProxy from './proxyServerConfig.util'
2021
export * as datetime from './datetime.util'
2122
export * as filter from './filter.util'
2223
export * as form from './form.util'
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
Copyright 2019 Iguazio Systems Ltd.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License") with
5+
an addition restriction as set forth herein. You may not use this
6+
file except in compliance with the License. You may obtain a copy of
7+
the License at http://www.apache.org/licenses/LICENSE-2.0.
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
implied. See the License for the specific language governing
13+
permissions and limitations under the License.
14+
15+
In addition, you may not use the software for any purposes that are
16+
illegal under applicable law, and the grant of the foregoing license
17+
under the Apache 2.0 license is conditioned upon your compliance with
18+
such restriction.
19+
*/
20+
21+
export const mlrunProxyConfig = env => ({
22+
'/api': env.VITE_MLRUN_API_URL
23+
? {
24+
target: env.VITE_MLRUN_API_URL,
25+
changeOrigin: true,
26+
headers: {
27+
Connection: 'keep-alive',
28+
'x-v3io-session-key': env.VITE_MLRUN_V3IO_ACCESS_KEY,
29+
'x-remote-user': 'admin'
30+
}
31+
}
32+
: undefined,
33+
'/nuclio': env.VITE_NUCLIO_API_URL
34+
? {
35+
target: env.VITE_NUCLIO_API_URL,
36+
changeOrigin: true,
37+
rewrite: path => path.replace(/^\/nuclio/, '')
38+
}
39+
: undefined,
40+
'/iguazio': env.VITE_IGUAZIO_API_URL
41+
? {
42+
target: env.VITE_IGUAZIO_API_URL,
43+
changeOrigin: true,
44+
rewrite: path => path.replace(/^\/iguazio/, '')
45+
}
46+
: undefined,
47+
'/function-catalog': env.VITE_FUNCTION_CATALOG_URL
48+
? {
49+
target: env.VITE_FUNCTION_CATALOG_URL,
50+
changeOrigin: true,
51+
rewrite: path => path.replace(/^\/function-catalog/, '')
52+
}
53+
: undefined
54+
})
55+
56+
void ['mlrunProxyConfig', 'rewrite']

0 commit comments

Comments
 (0)