feat: reload when config apply
This commit is contained in:
@ -93,6 +93,7 @@ func newConfigCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
m.CoreConfig.Apply()
|
||||
m.Core.ReloadService()
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
||||
@ -155,7 +155,6 @@ func newServiceRestartCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
func newServiceReloadCmd() *cobra.Command {
|
||||
var name string
|
||||
c := &cobra.Command{
|
||||
Use: "reload",
|
||||
Short: "Reload mihomo service configuration (via API)",
|
||||
@ -165,13 +164,12 @@ func newServiceReloadCmd() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !m.Core.ReloadService(name) {
|
||||
if !m.Core.ReloadService() {
|
||||
return errSilentFailure
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
withNameFlag(c, &name)
|
||||
return c
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ func newSubscriptionRefreshCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
m.Subscription.RefreshSubscription(args[0], backup)
|
||||
m.Core.ReloadService("mihomo")
|
||||
m.Core.ReloadService()
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@ -141,7 +141,7 @@ func newSubscriptionActivateCmd() *cobra.Command {
|
||||
}
|
||||
m.Subscription.ActivateSubscription(args[0])
|
||||
if m.CoreConfig.Apply() {
|
||||
m.Core.ReloadService("mihomo")
|
||||
m.Core.ReloadService()
|
||||
}
|
||||
return nil
|
||||
},
|
||||
@ -160,7 +160,7 @@ func newSubscriptionDeactivateCmd() *cobra.Command {
|
||||
}
|
||||
m.Subscription.DeactivateSubscription(args[0])
|
||||
if m.CoreConfig.Apply() {
|
||||
m.Core.ReloadService("mihomo")
|
||||
m.Core.ReloadService()
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user