Skip to content

Commit 7eda134

Browse files
committed
Refactor config loading logic to use singleton pattern
1 parent 7f5f0a2 commit 7eda134

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/configs/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ class Config {
6868
}
6969
return validatedConfig;
7070
}
71+
72+
static getInstance() {
73+
if (!Config.instance) {
74+
new Config();
75+
}
76+
return Config.instance;
77+
}
7178
}
7279

73-
const instance = new Config();
74-
module.exports = instance.config;
80+
module.exports = Config.getInstance().config;

0 commit comments

Comments
 (0)