@hadoku/game-server 0.1.41 → 0.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -55,6 +55,8 @@ export interface CreateConfigOptions {
55
55
  * `ROOMS_DIR: 'state/rooms'`): what a variable the environment leaves unset reads as.
56
56
  */
57
57
  defaults?: Readonly<Record<string, string>>;
58
+ /** Admit `public` as the floor: a game the edge serves to everyone. Default false: `public` refuses boot. */
59
+ allowPublic?: boolean;
58
60
  }
59
61
  export interface GameServerConfig {
60
62
  /** Port this server listens on. cloudflared points the tunnel hostname here. */
package/dist/config.js CHANGED
@@ -55,7 +55,7 @@ export function createConfig(options = {}) {
55
55
  const logDir = resolveDir(read('LOG_DIR') || (stateDir ? join(stateDir, 'logs') : 'logs'));
56
56
  const dataDir = stateDir || resolve(logDir, '../data');
57
57
  const minTierRaw = read('MIN_TIER') || 'friend';
58
- const minTier = kernelAssertFloor(minTierRaw, { envPrefix: prefix, allowPublic: false });
58
+ const minTier = kernelAssertFloor(minTierRaw, { envPrefix: prefix, allowPublic: options.allowPublic === true });
59
59
  return {
60
60
  port: parseInt(read('PORT') || '9008', 10),
61
61
  host: read('HOST') || '127.0.0.1',
@@ -89,6 +89,8 @@ export interface RelayGameOptions {
89
89
  repoRoot: string;
90
90
  /** The game's own config defaults by unprefixed name (`PORT`, `BASE_PREFIX`, `ROOMS_DIR`, …). */
91
91
  defaults: Readonly<Record<string, string>>;
92
+ /** A game the edge serves to everyone may set its floor to `public`; any other refuses it at boot. */
93
+ allowPublic?: boolean;
92
94
  /** The participant-id domain, so ids are this game's own and never another's (`room/identity.ts`). */
93
95
  participantDomain: string;
94
96
  gameType: string;
@@ -75,7 +75,7 @@ export async function startRelayGame(options) {
75
75
  configureParticipantIdDomain(options.participantDomain);
76
76
  const { id, envPrefix } = options;
77
77
  const env = process.env;
78
- const config = createConfig({ envPrefix, root: options.root, defaults: options.defaults });
78
+ const config = createConfig({ envPrefix, root: options.root, defaults: options.defaults, ...(options.allowPublic === true ? { allowPublic: true } : {}) });
79
79
  const auth = createGameAuth(config, { svc: id });
80
80
  mkdirSync(config.logDir, { recursive: true });
81
81
  const setting = (name) => env[`${envPrefix}_${name}`] ?? options.defaults[name];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-server",
3
- "version": "0.1.41",
4
- "gitHead": "9b7ac7af9532342956440694724948db4efae101",
3
+ "version": "0.1.43",
4
+ "gitHead": "fabe2b63854c082ab7910ca6169ed6473135bed0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "The server parts any hosted game shares, above the kernel: the app config and edge auth, the room core (identity, seats, sessions, membership, the room list, the generic room routes), match hosting (the host contract, local and remote JVMs, placement, the start queue, recordings, the in-process and relay runtimes), streams, erase, telemetry and usage. Knows no game; Magic plugs in from apps/server. MIT; imports only node built-ins, express, socket.io, @wolffm/* and the platform packages.",
@@ -16,9 +16,9 @@
16
16
  "play/remote/"
17
17
  ],
18
18
  "dependencies": {
19
- "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.41",
20
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.41",
21
- "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.74",
19
+ "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.43",
20
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.43",
21
+ "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.76",
22
22
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.27",
23
23
  "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.110",
24
24
  "@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.110",