Skip to content

Commit 18460f6

Browse files
committed
fix: catch startup error when prometheus is not accessible/configureswq
1 parent 025a63e commit 18460f6

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

server/src/configure.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const { KUBERO_SESSION_KEY = crypto.randomBytes(20).toString('hex') } = process.
3535

3636
export const configure = async (app: Express, server: Server) => {
3737
// Load Version from File
38-
process.env.npm_package_version = fs.readFileSync('./VERSION','utf8');;
38+
process.env.npm_package_version = fs.readFileSync('./VERSION','utf8');
39+
40+
console.log("Kubero Version: " + process.env.npm_package_version);
3941

4042
app.use(cors())
4143
app.use(cookieParser())

server/src/modules/metrics.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,16 @@ export class Metrics {
6464
}
6565

6666
public async getStatus(): Promise<boolean> {
67-
const status = await this.prom.status();
68-
if (status === undefined || status === null || status === false) {
67+
try {
68+
const status = await this.prom.status();
69+
70+
if (status === undefined || status === null || status === false) {
71+
return false;
72+
} else {
73+
return true;
74+
}
75+
} catch (error) {
6976
return false;
70-
} else {
71-
return true;
7277
}
7378
}
7479

0 commit comments

Comments
 (0)