hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/lib/config.js
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-29 02:17:12 +0200
committerhachem <im@hachem.wtf>2026-08-29 02:17:12 +0200
commite56d21fa04450d118f76347a96a12d1d5477958f (patch)
tree06d590ef64153e2ab92306a4a7cc63d6fef47286 /lib/config.js
parent43d92fd60d75c4a1260757c75b1e1eefc0ea8952 (diff)
setup: prepare go workspace
Diffstat (limited to 'lib/config.js')
-rw-r--r--lib/config.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/config.js b/lib/config.js
deleted file mode 100644
index 9d2ed39..0000000
--- a/lib/config.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const path = require("path")
-const fs = require("fs-extra")
-
-const configPath = path.join(__dirname, "../config/config.json")
-const apiPath = path.join(__dirname, "../config/api.json")
-const cachePath = path.join(__dirname, "../cache/mod_versions.json")
-
-const LoadConfig = () =>
-{
- return require(configPath)
-}
-
-const LoadApi = () =>
-{
- try
- {
- return require(apiPath)
- }
- catch
- {
- return {}
- }
-}
-
-const LoadCache = async () =>
-{
- try
- {
- if (await fs.pathExists(cachePath))
- return JSON.parse(await fs.readFile(cachePath, "utf8"))
- }
- catch (err)
- {
- console.error("[Cache] Failed to load:", err)
- }
- return {}
-}
-
-const SaveCache = async cache =>
-{
- try
- {
- await fs.ensureDir(path.dirname(cachePath))
- await fs.writeFile(cachePath, JSON.stringify(cache, null, 2))
- }
- catch (err)
- {
- console.error("[Cache] Failed to save:", err)
- }
-}
-
-module.exports =
-{
- configPath,
- apiPath,
- cachePath,
- LoadConfig,
- LoadApi,
- LoadCache,
- SaveCache
-}
-