From 7679c298e2dc0fe920303da7115cdb67c5297d91 Mon Sep 17 00:00:00 2001 From: Roy Razon Date: Wed, 26 Jul 2023 10:39:40 +0300 Subject: [PATCH] cta: web-server->api-server --- packages/compose-tunnel-agent/index.ts | 8 ++++---- .../compose-tunnel-agent/src/{web.ts => api-server.ts} | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) rename packages/compose-tunnel-agent/src/{web.ts => api-server.ts} (94%) diff --git a/packages/compose-tunnel-agent/index.ts b/packages/compose-tunnel-agent/index.ts index 237aae56..f7af93f0 100644 --- a/packages/compose-tunnel-agent/index.ts +++ b/packages/compose-tunnel-agent/index.ts @@ -8,7 +8,7 @@ import pinoPretty from 'pino-pretty' import { EOL } from 'os' import { ConnectionCheckResult, requiredEnv, checkConnection, formatPublicKey, parseSshUrl, SshConnectionConfig, tunnelNameResolver } from '@preevy/common' import createDockerClient from './src/docker' -import createWebServer from './src/web' +import createApiServer from './src/api-server' import { sshClient as createSshClient } from './src/ssh' const homeDir = process.env.HOME || '/root' @@ -120,14 +120,14 @@ const main = async () => { await rimraf(listenAddress) } - const webServer = createWebServer({ - log: log.child({ name: 'web' }), + const apiServer = createApiServer({ + log: log.child({ name: 'api' }), currentSshState: async () => ( await currentTunnels ), }) .listen(listenAddress, () => { - log.info(`listening on ${inspect(webServer.address())}`) + log.info(`listening on ${inspect(apiServer.address())}`) }) .on('error', err => { log.error(err) diff --git a/packages/compose-tunnel-agent/src/web.ts b/packages/compose-tunnel-agent/src/api-server.ts similarity index 94% rename from packages/compose-tunnel-agent/src/web.ts rename to packages/compose-tunnel-agent/src/api-server.ts index 725ba2e1..f7fc05d8 100644 --- a/packages/compose-tunnel-agent/src/web.ts +++ b/packages/compose-tunnel-agent/src/api-server.ts @@ -15,7 +15,7 @@ const respondJson = ( const respondNotFound = (res: http.ServerResponse) => respond(res, 'Not found', 'text/plain', 404) -const createWebServer = ({ +const createApiServer = ({ log, currentSshState, }: { log: Logger @@ -42,4 +42,4 @@ const createWebServer = ({ respondNotFound(res) }) -export default createWebServer +export default createApiServer