Skip to content

Commit

Permalink
Show runtime (Bun) version on info page
Browse files Browse the repository at this point in the history
  • Loading branch information
thaapasa committed Nov 19, 2024
1 parent d31bbb7 commit 512c273
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/client/ui/info/VersionInfoView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ import { InfoItem, ItemWithId, Label, Value } from './InfoLayoutElements';
interface VersionInfo {
version: string;
revision: string;
runtimeVersion: string;
}

export const VersionInfoView = () => {
const [serverVersion, setServerVersion] = React.useState<VersionInfo | null>(null);
React.useMemo(async () => {
const status = await apiConnect.getApiStatus();
logger.info(status, `API status`);
setServerVersion({ version: status.version, revision: status.revision });
setServerVersion({
version: status.version,
revision: status.revision,
runtimeVersion: status.runtimeVersion,
});
}, [setServerVersion]);
const doReload = React.useCallback(() => reloadApp(infoPagePath), []);

Expand All @@ -33,7 +38,8 @@ export const VersionInfoView = () => {
</ItemWithId>
{serverVersion ? (
<ItemWithId id="Palvelin">
{serverVersion.version} ({serverVersion.revision})
{serverVersion.version} ({serverVersion.revision}, runtime{' '}
{serverVersion.runtimeVersion})
</ItemWithId>
) : null}
<ItemWithId id="Päivitä">
Expand Down
1 change: 1 addition & 0 deletions src/server/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Config {
public commitId = revision.commitId;
public revision = revision.commitId.substring(0, 8);
public commitMessage = revision.message;
public bunVersion = Bun.version;

public host = hostname();
public port = port ? parseInt(port, 10) : 3100;
Expand Down
1 change: 1 addition & 0 deletions src/server/api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function createApi() {
status: 'OK',
timestamp: toDayjs().format(),
version: config.version,
runtimeVersion: config.bunVersion,
revision: config.revision,
commitId: config.commitId,
environment: config.environment,
Expand Down
1 change: 1 addition & 0 deletions src/shared/types/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type ApiStatus = Readonly<{
status: string;
timestamp: string;
version: string;
runtimeVersion: string;
commitId: string;
revision: string;
environment: string;
Expand Down

0 comments on commit 512c273

Please sign in to comment.