Commit 3d1cb720 authored by Will Cory's avatar Will Cory Committed by GitHub

feat(common-ts): BSV2 Add version to healthz for convenience (#2815)

* add version to healthz for convenience

* changeset
Co-authored-by: default avatarWill Cory <willcory@Wills-MacBook-Pro.local>
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent b09bc9bc
---
'@eth-optimism/common-ts': minor
---
Add version to healthz for convenience
......@@ -144,7 +144,8 @@ export abstract class BaseServiceV2<
* @param params.port Port for the app server. Defaults to 7300.
* @param params.hostname Hostname for the app server. Defaults to 0.0.0.0.
*/
constructor(params: {
constructor(
private readonly params: {
name: string
version: string
optionsSpec: OptionsSpec<TOptions>
......@@ -154,7 +155,8 @@ export abstract class BaseServiceV2<
loopIntervalMs?: number
port?: number
hostname?: string
}) {
}
) {
this.loop = params.loop !== undefined ? params.loop : true
this.state = {} as TServiceState
......@@ -404,6 +406,7 @@ export abstract class BaseServiceV2<
app.get('/healthz', async (req, res) => {
return res.json({
ok: this.healthy,
version: this.params.version,
})
})
......@@ -429,7 +432,7 @@ export abstract class BaseServiceV2<
}
return '/invalid_path_not_a_real_route'
}
},
})
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment