# opencode-gateway System Settings Documentation This document describes the system settings that may be modified when using the `opencode-gateway setup` command in server mode. ## Settings Changed by `setup` Command ### Power Management (pmset) The following power settings may be modified to optimize for server operation: | Setting | Default | Changed To | Description | |---------|---------|------------|-------------| | `sleep` | varies | 0 (never) | Prevent system from sleeping | | `displaysleep` | varies | 10 (minutes) | Turn off display after 10 minutes | | `disksleep` | varies | 10 (minutes) | Spin down disks after 10 minutes | | `womp` (wake-on-network) | 0 | 1 | Enable wake on network activity | **Desktop vs Laptop:** On laptops, settings are applied to both AC (`-c`) and battery (`-b`) profiles. Desktops skip battery settings. ### Network Settings - **Wake-on-network**: Enabled to allow the server to wake from sleep when network activity is detected ## How Restoration Works When you run `opencode-gateway down`, the system automatically: 1. Stops the service 2. Restores original power settings from the backup file at: `~/.config/opencode-gateway/.power-backup` ### Manual Restoration If needed, settings can be manually restored using `pmset`: ```bash # View current settings pmset -g # Restore specific settings (example values) sudo pmset sleep 30 # Sleep after 30 minutes sudo pmset displaysleep 10 # Display sleep after 10 minutes sudo pmset disksleep 10 # Disk sleep after 10 minutes sudo pmset womp 0 # Disable wake-on-network ``` ## Security Notes - Settings are backed up before any changes are made - Backup is stored in your user config directory (`~/.config/opencode-gateway/`) - Original settings are automatically restored on `down` command - Settings persist across reboots until restored ## Files Modified | File | Purpose | |------|---------| | `~/.config/opencode-gateway/.power-backup` | Stores original power settings before modification | | `~/.config/opencode-gateway/config` | Stores script configuration | ## See Also - `opencode-gateway setup` - Configure server system settings - `opencode-gateway stop` - Stop service without restoring settings - `opencode-gateway down` - Stop service and restore settings - `pmset(1)` - macOS power management manual