Skip to content

Commit

Permalink
feat: remove env variable PUBLIC_DIR
Browse files Browse the repository at this point in the history
We can automatically deduce the value of this variable, so no need
to explicitly configure it in the env files.
  • Loading branch information
aradzie committed Nov 11, 2024
1 parent 6b069ca commit 66104f3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ APP_URL=http://localhost:3000/
COOKIE_DOMAIN=localhost
COOKIE_SECURE=false
DATA_DIR=~/.local/state/keybr
PUBLIC_DIR=~/keybr.com/root/public

DATABASE_CLIENT=sqlite
DATABASE_FILENAME=~/.local/state/keybr/database.sqlite
Expand Down
2 changes: 2 additions & 0 deletions packages/server/lib/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cluster, { type ClusterSettings } from "node:cluster";
import { Application } from "@fastr/core";
import { Container } from "@fastr/invert";
import { Manifest } from "@keybr/assets";
import { ConfigModule, Env } from "@keybr/config";
import { Logger } from "@keybr/logger";
import { Game } from "@keybr/multiplayer-server";
Expand Down Expand Up @@ -53,6 +54,7 @@ function makeContainer() {
container.load(new ConfigModule());
container.load(new ApplicationModule());
container.load(new ServerModule());
container.get(Manifest); // Sanity check.
return container;
}

Expand Down
5 changes: 5 additions & 0 deletions root/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

const { join } = require("node:path");

process.env.PUBLIC_DIR = join(__dirname, "public");
1 change: 1 addition & 0 deletions root/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

"use strict";

require("./_config.js");
require("./lib/index.js");
1 change: 1 addition & 0 deletions root/keybr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

"use strict";

require("./_config.js");
require("./lib/keybr.js");

0 comments on commit 66104f3

Please sign in to comment.