Integrate with system service managers #34
Draft
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.
Closes: #21
This is a port of the code mentioned in #21.
It works, but I'm likely going to make a fork of the
service
pkg.Some fixes need to be incorporated, and the API could benefit from change.
Particularly, the handling of system specific options is done via a
map[string]interface{}
, where the map keys are not exported and the values circumvent the type system. I think this could be changed so that theConfig
struct simply has different struct members based on which OS is being built for. This would eliminate the chance of using the wrong key or value type at compile time, rather than depending on reflection and possibly having unexpected behaviour.In addition, some of the service files are generated from text templates. Like the launchd plist and systemd unit files.
It would be better if these utilized libraries which generated those files for us, through some standard and maintained API built specifically for those systems. This would make it easy to stay in sync with any changes, while also bolstering assurance that the files generated are well formed and standard compliant.