# Load room-config.js at Node-RED startup (fix "require is not defined")

Function nodes cannot use `require()`. Load the config in **settings.js** instead.

1. **On the Node-RED server**, edit:
   ```bash
   nano /root/.node-red/settings.js
   ```

2. **Find** the block that looks like:
   ```javascript
   functionGlobalContext: {
       // os:require('os'),
   },
   ```

3. **Add** the room config so it becomes:
   ```javascript
   functionGlobalContext: {
       roomConfig: require('/root/.node-red/room-config.js'),
       // os:require('os'),
   },
   ```
   (Use the correct path to your `room-config.js` if different.)

4. **Save**, then **restart Node-RED**:
   ```bash
   systemctl restart node-red
   ```
   or however you run Node-RED.

5. In your flows, **remove or disconnect** the "Load room config" Function node (or leave it unused). All nodes that use `global.get('roomConfig')` will get the config automatically.

**When you change room-config.js:** upload the file to the server, then restart Node-RED to reload it.
