feat: Enhance service manager with zinit socket discovery and systemd fallback
- Improve Linux support by automatically discovering zinit sockets using environment variables and common paths. - Add fallback to systemd if no zinit server is detected. - Enhance README with detailed instructions for zinit usage, including custom socket path configuration. - Add example demonstrating zinit socket discovery. - Add logging to show socket discovery process. - Add unit tests for service manager creation and socket discovery.
This commit is contained in:
@@ -159,15 +159,34 @@ herodo your_service_script.rhai
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Linux (zinit)
|
||||
### Linux (zinit/systemd)
|
||||
|
||||
Make sure zinit is installed and running:
|
||||
The service manager automatically discovers running zinit servers and falls back to systemd if none are found.
|
||||
|
||||
**For zinit (recommended):**
|
||||
|
||||
```bash
|
||||
# Start zinit with default socket
|
||||
zinit -s /tmp/zinit.sock init
|
||||
|
||||
# Or with a custom socket path
|
||||
zinit -s /var/run/zinit.sock init
|
||||
```
|
||||
|
||||
**Socket Discovery:**
|
||||
The service manager will automatically find running zinit servers by checking:
|
||||
1. `ZINIT_SOCKET_PATH` environment variable (if set)
|
||||
2. Common socket locations: `/var/run/zinit.sock`, `/tmp/zinit.sock`, `/run/zinit.sock`, `./zinit.sock`
|
||||
|
||||
**Custom socket path:**
|
||||
```bash
|
||||
# Set custom socket path
|
||||
export ZINIT_SOCKET_PATH=/your/custom/path/zinit.sock
|
||||
```
|
||||
|
||||
**Systemd fallback:**
|
||||
If no zinit server is detected, the service manager automatically falls back to systemd.
|
||||
|
||||
### macOS (launchctl)
|
||||
|
||||
No additional setup required - uses the built-in launchctl system.
|
||||
|
Reference in New Issue
Block a user