cmd/ctrld: add commands to control ctrld as a system service

Supported actions:

 - start: install and start ctrld as a system service
 - stop: stop the ctrld service
 - restart: restart ctrld service
 - status: show status of ctrld service
 - uninstall: remove ctrld from system service
This commit is contained in:
Cuong Manh Le
2022-12-23 21:35:26 +07:00
committed by Cuong Manh Le
parent 9e7578fb29
commit ec72af1916
8 changed files with 315 additions and 39 deletions
+1
View File
@@ -12,6 +12,7 @@ import (
func SampleConfig(t *testing.T) *ctrld.Config {
v := viper.NewWithOptions(viper.KeyDelimiter("::"))
ctrld.InitConfig(v, "test_load_config")
v.SetConfigType("toml")
require.NoError(t, v.ReadConfig(strings.NewReader(sampleConfigContent)))
var cfg ctrld.Config
require.NoError(t, v.Unmarshal(&cfg))