- service.v: --install-service / --uninstall-service / --service-status Windows (sc.exe SCM), Linux systemd, Linux openrc — auto-détection OS - main.v: nouveaux flags service, help mis à jour - Dockerfile: multi-stage (V from source → alpine:3.20 minimal) - docker-compose.yml: prêt à l'emploi avec healthcheck - scripts/install.sh: one-liner Linux (detect OS/arch, build, install) - scripts/install.ps1: one-liner Windows PowerShell Docs: ROADMAP Phase 4.5 marqué DONE, version 0.4.5
This commit is contained in:
@@ -3,7 +3,7 @@ module main
|
||||
import os
|
||||
import flag
|
||||
|
||||
const version = '0.4.0'
|
||||
const version = '0.4.5'
|
||||
const author = 'Bruno Charest'
|
||||
|
||||
fn main() {
|
||||
@@ -17,6 +17,9 @@ fn main() {
|
||||
validate_only := fp.bool('validate', `v`, false, 'Validate config and exit')
|
||||
quiet := fp.bool('quiet', `q`, false, 'Quiet mode — suppress startup banner (for scripts/systemd)')
|
||||
version_only := fp.bool('version', `V`, false, 'Print version and exit')
|
||||
install_svc := fp.bool('install-service', 0, false, 'Install as a system service (auto-detects OS)')
|
||||
uninstall_svc := fp.bool('uninstall-service', 0, false, 'Uninstall the system service')
|
||||
svc_status := fp.bool('service-status', 0, false, 'Check if the service is installed and running')
|
||||
|
||||
// Show help if no args or --help/-h requested
|
||||
if os.args.len <= 1 || '--help' in os.args || '-h' in os.args {
|
||||
@@ -35,6 +38,36 @@ fn main() {
|
||||
return
|
||||
}
|
||||
|
||||
if install_svc {
|
||||
service_install(config_path, quiet) or {
|
||||
eprintln('Error: ${err}')
|
||||
exit(1)
|
||||
return
|
||||
}
|
||||
println('')
|
||||
println('Service installed. Edit ${config_path} to configure sources,')
|
||||
println('then restart the service to apply changes.')
|
||||
return
|
||||
}
|
||||
|
||||
if uninstall_svc {
|
||||
service_uninstall() or {
|
||||
eprintln('Error: ${err}')
|
||||
exit(1)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if svc_status {
|
||||
service_status() or {
|
||||
eprintln('Error: ${err}')
|
||||
exit(1)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
cfg := load_config(config_path) or {
|
||||
eprintln('Failed to load config: ${err}')
|
||||
exit(1)
|
||||
@@ -110,6 +143,11 @@ fn print_help() {
|
||||
println(' -V, --version Print version and exit')
|
||||
println(' -h, --help Show this help message')
|
||||
println('')
|
||||
println('Service management:')
|
||||
println(' --install-service Install as a system service (auto-detects OS)')
|
||||
println(' --uninstall-service Uninstall the system service')
|
||||
println(' --service-status Check if the service is installed and running')
|
||||
println('')
|
||||
println('Config:')
|
||||
println(' Copy ntfy-bridge.example.yaml → ntfy-bridge.yaml and edit it.')
|
||||
println(' Use NTFY_TOKEN and NTFY_HMAC_SECRET env vars for secrets.')
|
||||
|
||||
Reference in New Issue
Block a user