server icon indicating copy to clipboard operation
server copied to clipboard

Fails to start when config file is read-only

Open boogiewoogit opened this issue 5 months ago • 2 comments

I'm running the current flake on a nixos system wherein (as is customary for nixos) a read-only config file to be used is produced.

When I then start the server, it fails with

[Config] Using CONFIG_PATH rather than database
Error: EROFS: read-only file system, open '/nix/store/7cd3mwihyc8bz1h6djjbani0xl5wnipf-spacebarchat-server.json'
    at async open (node:internal/fs/promises:633:25)
    at async Object.writeFile (node:internal/fs/promises:1207:14)
    at async applyConfig (/nix/store/5sc4hffkn42y8z2ik1pm59mc3p70gkyv-spacebar-server-ts/dist/util/util/Config.js:91:9)
    at async main (/nix/store/5sc4hffkn42y8z2ik1pm59mc3p70gkyv-spacebar-server-ts/dist/bundle/Server.js:56:5) {
  errno: -30,
  code: 'EROFS',
  syscall: 'open',
  path: '/nix/store/7cd3mwihyc8bz1h6djjbani0xl5wnipf-spacebarchat-server.json'

Running the server with a writeable config file works fine.

boogiewoogit avatar Jul 03 '25 10:07 boogiewoogit

After some more experimenting I saw the issue: spacebar wants to write the missing default settings to the file.

A clean way to solve this, if it's technically possible and in alignment with the project's design intentions, would be to have any settings defined in the config file just override values in the database. FWIW, in general I personally don't expect software to write to a config file I supply it with.

boogiewoogit avatar Jul 03 '25 12:07 boogiewoogit

I uh... oops, that code was written before I switched to NixOS so that never got accounted for. It writing to the config file (or at least attempting to) was supposed to be a server-admin UX thing, so you dont have to cross reference with the source code in order to update.

  • Emma [it/its] @ Rory&

TheArcaneBrony avatar Jul 03 '25 14:07 TheArcaneBrony