Skip to content

Commit

Permalink
jsonc
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Aug 12, 2023
1 parent fe5b8e7 commit 6b61b71
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@octokit/rest": "^19.0.13",
"@uwu-codes/status-server": "^1.0.1",
"@uwu-codes/utils": "^1.3.3",
"jsonc-parser": "^3.2.0",
"oceanic.js": "^1.7.1"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/member-ordering */
import { EnvOverride } from "@uwu-codes/utils";
import { parse } from "jsonc-parser";
import { access, readFile } from "node:fs/promises";

interface JSONConfig {
Expand All @@ -11,12 +12,12 @@ interface JSONConfig {
githubToken: string;
}

const json = JSON.parse(await readFile(new URL("../../config.json", import.meta.url), "utf8")) as JSONConfig;
const json = parse(await readFile(new URL("../../config.jsonc", import.meta.url), "utf8")) as JSONConfig;

const isDocker = await access("/.dockerenv").then(() => true, () => false) || await readFile("/proc/1/cgroup", "utf8").then(contents => contents.includes("docker"));
class Configuration {
static get isDevelopment() {
return process.env.NODE_ENV !== "production";
return !isDocker;
}

static get isDocker() {
Expand Down

0 comments on commit 6b61b71

Please sign in to comment.