perf: remove env SERVER_URL and use url to get real server url
This commit is contained in:
parent
28dd506cb4
commit
81e7f8651a
@ -9,7 +9,6 @@ services:
|
|||||||
JWT_SECRET: replace-me-with-a-random-string
|
JWT_SECRET: replace-me-with-a-random-string
|
||||||
ALLOW_REGISTER: "false"
|
ALLOW_REGISTER: "false"
|
||||||
ALLOW_OPENAPI: "true"
|
ALLOW_OPENAPI: "true"
|
||||||
SERVER_URL:
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -294,7 +294,7 @@ ServerList.displayName = 'ServerList';
|
|||||||
|
|
||||||
export const InstallScript: React.FC = React.memo(() => {
|
export const InstallScript: React.FC = React.memo(() => {
|
||||||
const workspaceId = useCurrentWorkspaceId();
|
const workspaceId = useCurrentWorkspaceId();
|
||||||
const command = `curl -o- ${window.location.origin}/serverStatus/${workspaceId}/install.sh | bash`;
|
const command = `curl -o- ${window.location.origin}/serverStatus/${workspaceId}/install.sh?url=${window.location.origin} | bash`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -35,7 +35,9 @@ serverStatusRouter.get(
|
|||||||
validate(param('workspaceId').isString()),
|
validate(param('workspaceId').isString()),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { workspaceId } = req.params;
|
const { workspaceId } = req.params;
|
||||||
const server = env.serverUrl || `${req.protocol}://${req.get('Host')}`;
|
const queryUrl = req.query.url ? String(req.query.url) : undefined;
|
||||||
|
|
||||||
|
const server = queryUrl || `${req.protocol}://${req.get('Host')}`;
|
||||||
|
|
||||||
res
|
res
|
||||||
.setHeader('Content-Type', 'text/plain')
|
.setHeader('Content-Type', 'text/plain')
|
||||||
|
@ -2,7 +2,6 @@ export const env = {
|
|||||||
allowRegister: checkEnvTrusty(process.env.ALLOW_REGISTER),
|
allowRegister: checkEnvTrusty(process.env.ALLOW_REGISTER),
|
||||||
allowOpenapi: checkEnvTrusty(process.env.ALLOW_OPENAPI),
|
allowOpenapi: checkEnvTrusty(process.env.ALLOW_OPENAPI),
|
||||||
websiteId: process.env.WEBSITE_ID,
|
websiteId: process.env.WEBSITE_ID,
|
||||||
serverUrl: process.env.SERVER_URL, // example: https://tianji.example.com
|
|
||||||
sandboxMemoryLimit: process.env.SANDBOX_MEMORY_LIMIT
|
sandboxMemoryLimit: process.env.SANDBOX_MEMORY_LIMIT
|
||||||
? Number(process.env.SANDBOX_MEMORY_LIMIT)
|
? Number(process.env.SANDBOX_MEMORY_LIMIT)
|
||||||
: 16, // MB
|
: 16, // MB
|
||||||
|
@ -24,8 +24,6 @@ vim docker-compose.yml
|
|||||||
|
|
||||||
you should change `JWT_SECRET` to make your token safe.
|
you should change `JWT_SECRET` to make your token safe.
|
||||||
|
|
||||||
and change `SERVER_URL` to make sure you can quick run `install.sh` in server status report if you have many level gateway.
|
|
||||||
|
|
||||||
Then, run it!
|
Then, run it!
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user