-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev-env introspection server (#2470)
* add dev-env introspection server * Update packages/dev-env/src/introspect.ts Co-authored-by: devin ivy <devinivy@gmail.com> * lost a bracket --------- Co-authored-by: devin ivy <devinivy@gmail.com>
- Loading branch information
Showing
6 changed files
with
95 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import http from 'node:http' | ||
import events from 'node:events' | ||
import express from 'express' | ||
import { TestPlc } from './plc' | ||
import { TestPds } from './pds' | ||
import { TestBsky } from './bsky' | ||
import { TestOzone } from './ozone' | ||
|
||
export class IntrospectServer { | ||
constructor( | ||
public port: number, | ||
public server: http.Server, | ||
) {} | ||
|
||
static async start( | ||
port: number, | ||
plc: TestPlc, | ||
pds: TestPds, | ||
bsky: TestBsky, | ||
ozone: TestOzone, | ||
) { | ||
const app = express() | ||
app.get('/', (_req, res) => { | ||
res.status(200).send({ | ||
plc: { | ||
url: plc.url, | ||
}, | ||
pds: { | ||
url: pds.url, | ||
did: pds.ctx.cfg.service.did, | ||
}, | ||
bsky: { | ||
url: bsky.url, | ||
did: bsky.ctx.cfg.serverDid, | ||
}, | ||
ozone: { | ||
url: ozone.url, | ||
did: ozone.ctx.cfg.service.did, | ||
}, | ||
db: { | ||
url: ozone.ctx.cfg.db.postgresUrl, | ||
}, | ||
}) | ||
}) | ||
const server = app.listen(port) | ||
await events.once(server, 'listening') | ||
return new IntrospectServer(port, server) | ||
} | ||
|
||
async close() { | ||
this.server.close() | ||
await events.once(this.server, 'close') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.