cmd/cli: add skipping self checks flag

This commit is contained in:
Cuong Manh Le
2024-05-04 07:49:48 +07:00
committed by Cuong Manh Le
parent 29bf329f6a
commit c2556a8e39
2 changed files with 7 additions and 0 deletions

View File

@@ -401,6 +401,7 @@ func initCLI() {
startCmd.Flags().StringVarP(&iface, "iface", "", "", `Update DNS setting for iface, "auto" means the default interface gateway`)
startCmd.Flags().StringVarP(&nextdns, nextdnsFlagName, "", "", "NextDNS resolver id")
startCmd.Flags().StringVarP(&cdUpstreamProto, "proto", "", ctrld.ResolverTypeDOH, `Control D upstream type, either "doh" or "doh3"`)
startCmd.Flags().BoolVarP(&skipSelfChecks, "skip_self_checks", "", false, `Skip self checks after installing ctrld service`)
routerCmd := &cobra.Command{
Use: "setup",
@@ -1618,6 +1619,11 @@ func selfCheckStatus(s service.Service) (bool, service.Status, error) {
if status != service.StatusRunning {
return false, status, nil
}
// Skip self checks if set.
if skipSelfChecks {
return true, status, nil
}
dir, err := socketDir()
if err != nil {
mainLog.Load().Error().Err(err).Msg("failed to check ctrld listener status: could not get home directory")

View File

@@ -35,6 +35,7 @@ var (
nextdns string
cdUpstreamProto string
deactivationPin int64
skipSelfChecks bool
mainLog atomic.Pointer[zerolog.Logger]
consoleWriter zerolog.ConsoleWriter