diff --git a/docker-compose.yml b/docker-compose.yml index 6f82cfa..6adf136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,6 @@ services: JWT_SECRET: replace-me-with-a-random-string ALLOW_REGISTER: "false" ALLOW_OPENAPI: "true" - SERVER_URL: depends_on: - postgres restart: always diff --git a/src/client/pages/Servers.tsx b/src/client/pages/Servers.tsx index cd6e95e..3f8a618 100644 --- a/src/client/pages/Servers.tsx +++ b/src/client/pages/Servers.tsx @@ -294,7 +294,7 @@ ServerList.displayName = 'ServerList'; export const InstallScript: React.FC = React.memo(() => { 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 (
diff --git a/src/server/router/serverStatus.ts b/src/server/router/serverStatus.ts index 918175c..816335c 100644 --- a/src/server/router/serverStatus.ts +++ b/src/server/router/serverStatus.ts @@ -35,7 +35,9 @@ serverStatusRouter.get( validate(param('workspaceId').isString()), async (req, res) => { 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 .setHeader('Content-Type', 'text/plain') diff --git a/src/server/utils/env.ts b/src/server/utils/env.ts index 6f1bad9..6e21a88 100644 --- a/src/server/utils/env.ts +++ b/src/server/utils/env.ts @@ -2,7 +2,6 @@ export const env = { allowRegister: checkEnvTrusty(process.env.ALLOW_REGISTER), allowOpenapi: checkEnvTrusty(process.env.ALLOW_OPENAPI), websiteId: process.env.WEBSITE_ID, - serverUrl: process.env.SERVER_URL, // example: https://tianji.example.com sandboxMemoryLimit: process.env.SANDBOX_MEMORY_LIMIT ? Number(process.env.SANDBOX_MEMORY_LIMIT) : 16, // MB diff --git a/website/docs/deployments/docker.md b/website/docs/deployments/docker.md index de3c694..ffb67cd 100644 --- a/website/docs/deployments/docker.md +++ b/website/docs/deployments/docker.md @@ -24,8 +24,6 @@ vim docker-compose.yml 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! ```