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

feat: set serverUrlMap with env, update cypress, update stylelint #2583

Merged
merged 64 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6518f6e
feat: set serverUrlMap using environment variables
SkyeYoung Aug 11, 2022
e5be5de
feat: throw unset SERVER_URL_* error
SkyeYoung Aug 11, 2022
afb9848
fix: add SERVER_URL_TEST to frontend e2e test workflow
SkyeYoung Aug 11, 2022
abb6ff4
fix: SERVER_URL_TEST env
SkyeYoung Aug 11, 2022
42a8e8a
fix: ENV setting
SkyeYoung Aug 11, 2022
09e12e4
fix: correct env variable in ci
SkyeYoung Aug 11, 2022
121ff6c
fix: env variables, update cypress, migrate frontend e2e tests
SkyeYoung Aug 12, 2022
c567f68
chore: add license, rm usless deps
SkyeYoung Aug 12, 2022
5cc421e
fix: eslint rules
SkyeYoung Aug 12, 2022
bd39c1d
fix: workflow, eslint
SkyeYoung Aug 12, 2022
877fdf8
refactor: rm unnecessary config
SkyeYoung Aug 15, 2022
4c553ca
chore: deps
SkyeYoung Aug 15, 2022
d2aac36
refactor: e2e test plugin-schema
SkyeYoung Aug 16, 2022
1d552b6
chore: rb fe e2e wf
SkyeYoung Aug 17, 2022
e99ab98
Merge branch 'master' of https://github.com/apache/apisix-dashboard i…
SkyeYoung Aug 17, 2022
42519ef
fix: service-save-paginator-status.cy.js
SkyeYoung Aug 17, 2022
77027a0
fix: route fe e2e tests
SkyeYoung Aug 17, 2022
5448491
refactor: rm node 12.x, add 18.x
SkyeYoung Aug 18, 2022
cd7a6fa
refactor: MetaView.tsx
SkyeYoung Aug 18, 2022
45c3ce5
fix: add placeholder span
SkyeYoung Aug 18, 2022
225bebc
fix: error render
SkyeYoung Aug 18, 2022
1992fb4
fix: LabelsDrawer
SkyeYoung Aug 18, 2022
9db9487
fix: fetcher
SkyeYoung Aug 18, 2022
be2698b
fix: form instance
SkyeYoung Aug 18, 2022
3a4baf7
fix: swr
SkyeYoung Aug 18, 2022
a2cd640
chore: add log
SkyeYoung Aug 18, 2022
44e9996
fix: swr requests
SkyeYoung Aug 18, 2022
7f79d1b
fix: dataSource
SkyeYoung Aug 18, 2022
07cbb3d
refactor: e2e test batch-delete-route
SkyeYoung Aug 18, 2022
8e4fb9e
fix: MetaView
SkyeYoung Aug 18, 2022
1cb0c60
refactor: fe e2e can-skip-upstream-when-select-service-id
SkyeYoung Aug 18, 2022
affaff0
Merge branch 'master' of https://github.com/apache/apisix-dashboard i…
SkyeYoung Aug 18, 2022
b90cdf5
fix: node build workflow config
SkyeYoung Aug 18, 2022
2f8c520
fix: lint, tests
SkyeYoung Aug 19, 2022
118faa9
fix: e2e plugin, route tests
SkyeYoung Aug 19, 2022
10abc09
chore: update stylelint
SkyeYoung Aug 19, 2022
b33b0b8
chore: fix stylelint
SkyeYoung Aug 19, 2022
88aac76
fix: route e2e tests
SkyeYoung Aug 19, 2022
28fbd34
fix: nodejs >18 openssl provider
SkyeYoung Aug 19, 2022
93bc9b3
fix: nodejs >18 openssl
SkyeYoung Aug 19, 2022
59fe0d8
fix: MetaView data fetcher
SkyeYoung Aug 19, 2022
a597b86
chore: rm support for node18
SkyeYoung Aug 19, 2022
060e806
fix: LabelsDrawer
SkyeYoung Aug 19, 2022
e352860
fix: search-route e2e tests
SkyeYoung Aug 19, 2022
021781d
fix: tests
SkyeYoung Aug 19, 2022
a1cc2e7
chore: rm logs
SkyeYoung Aug 22, 2022
b6787d8
fix: LabelsDrawer, List
SkyeYoung Aug 22, 2022
64d570e
fix: LabelsDrawer
SkyeYoung Aug 22, 2022
cac1280
fix: useEffect
SkyeYoung Aug 22, 2022
1060b54
fix: MetaView
SkyeYoung Aug 22, 2022
0c20daa
fix: list key
SkyeYoung Aug 22, 2022
555555b
fix: LabelsDrawer
SkyeYoung Aug 22, 2022
1249b7a
fix: plugin schema filter
SkyeYoung Aug 22, 2022
fde82c0
fix: upstream-create_and_edit_upstream_with_no_nodes.cy.js
SkyeYoung Aug 22, 2022
5334b80
fix: Metaview datasource
SkyeYoung Aug 23, 2022
c5b427a
Merge branch 'feat-dotenv' of https://github.com/SkyeYoung/apisix-das…
SkyeYoung Aug 23, 2022
00b49d7
Merge branch 'master' into feat-dotenv
SkyeYoung Aug 23, 2022
1205d3e
chore: rm useless deps
SkyeYoung Aug 23, 2022
0bfb667
chore: rm useless deps
SkyeYoung Aug 23, 2022
6dcb6e9
fix: LabelsDrawer
SkyeYoung Aug 23, 2022
faa29b0
chore: reduce plugin e2e test time
SkyeYoung Aug 23, 2022
089ad99
Merge branch 'feat-dotenv' of https://github.com/SkyeYoung/apisix-das…
SkyeYoung Aug 23, 2022
0d64f94
chore: trying to make the test more stable
SkyeYoung Aug 23, 2022
cca085a
fix: command
SkyeYoung Aug 23, 2022
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ web/public/monaco-editor/
*.swp
*.swo

# .env
.env*
14 changes: 10 additions & 4 deletions docs/en/latest/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ $ make api-stop
$ cd ./web
```

2. Please change the `manager-api` address in the `config/defaultSettings.ts` file. If you follow this guidelines, the address may need to be set as below.
2. Please change the `manager-api` address in the `web/.env` file. If you follow this guidelines, the address may need to be set as below.

> All commands here are for Linux environment, other systems please use the corresponding commands for your platform. You are also welcome to contribute your own methods.

```bash
echo "SERVER_URL_DEV=http://localhost:9000" > web/.env
```
serveUrlMap:{
dev: 'http://localhost:9000'
}

If you don't want to create the file, you can also export the variable.

```bash
export SERVER_URL_DEV=http://localhost:9000
```

3. Launch development mode
Expand Down
24 changes: 21 additions & 3 deletions web/config/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
import { Settings as LayoutSettings } from '@ant-design/pro-layout';

export default {
const { SERVER_URL_DEV, SERVER_URL_TEST, REACT_APP_ENV } = process.env;
const defaultSettings = {
navTheme: 'dark',
primaryColor: '#1890ff',
layout: 'mix',
Expand All @@ -32,8 +33,8 @@ export default {
pwa: false,
iconfontUrl: '',
serveUrlMap: {
dev: 'http://139.217.190.60',
test: 'http://localhost:9000',
dev: SERVER_URL_DEV,
test: SERVER_URL_TEST,
},
} as LayoutSettings & {
pwa: boolean;
Expand All @@ -42,3 +43,20 @@ export default {
test: string;
};
};

const { dev, test } = defaultSettings.serveUrlMap;
const throwPromptError = (message: TemplateStringsArray) => {
throw new Error(
`Please set '${message[0]}' in 'web/.env' file. Guide: https://apisix.apache.org/docs/dashboard/develop/#web`,
);
};

if (REACT_APP_ENV === 'test' && !test) {
throwPromptError`SERVER_URL_TEST`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but should we use the most generic function call syntax? like throwPromptError("SERVER_URL_TEST");, although it still works, it may be confusing for those unfamiliar with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although we don't seem to have used it much in this project yet, it is actually relatively common, for example in emotion, styled components, graphql...

}

if (REACT_APP_ENV === 'dev' && !dev) {
throwPromptError`SERVER_URL_DEV`;
}

export default defaultSettings;