feat(service): refactor main to implement svc.Service interface and enhance logging #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
BasculaServicioproject to run as a proper Windows service, using thego-svclibrary for lifecycle management. It also introduces scripts for installing, uninstalling, and managing the service, improves logging, and sets the default to "test mode" for easier development and debugging.Key changes include:
Service Daemonization & Lifecycle Management:
svc.Serviceinterface using thego-svclibrary, enabling the program to run as a Windows service with proper start/stop handling and signal management. (cmd/BasculaServicio/main.go[1] [2]Programstruct withInit,Start, andStopmethods to manage service lifecycle, including graceful shutdown and goroutine management. (cmd/BasculaServicio/main.go[1] [2]Logging Improvements:
%PROGRAMDATA%\BasculaServicio\service.logdirectory, ensuring logs are persisted and accessible for troubleshooting. (cmd/BasculaServicio/main.gocmd/BasculaServicio/main.goL334-R410)Configuration & Defaults:
cmd/BasculaServicio/main.gocmd/BasculaServicio/main.goL31-R83)web/html/index_config.htmlweb/html/index_config.htmlL15-R15)Build & Service Management Scripts:
install.batanduninstall.batscripts for easy installation and removal of the Windows service, including automatic startup and description. (scripts/install.bat[1]scripts/uninstall.bat[2]commands.batwith shortcuts for starting, stopping, restarting, and querying the service status. (scripts/commands.batscripts/commands.batR1-R11)Dependency Updates:
go.modto addgo-svcand update other dependencies to ensure compatibility with the new service management approach. (go.modgo.modL6-R13)Minor:
docs.godescribing the purpose of the service. (cmd/BasculaServicio/docs.gocmd/BasculaServicio/docs.goR1-R2)