Skip to content

Commit

Permalink
fix: only init conf when running service
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiMeow committed Mar 7, 2024
1 parent e8e593a commit 63652b9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/bounce.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ var bounceCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(bounceCmd)

}
2 changes: 0 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"github.com/hdu-dn11/wg-quick-op/conf"
"github.com/sirupsen/logrus"
"os"

Expand Down Expand Up @@ -32,7 +31,6 @@ func init() {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
conf.Init(config)
}
rootCmd.PersistentFlags().StringVarP(&config, "config", "c", "/etc/wg-quick-op.yaml", "config file path")
}
2 changes: 2 additions & 0 deletions cmd/service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/hdu-dn11/wg-quick-op/conf"
"github.com/hdu-dn11/wg-quick-op/daemon"

"github.com/spf13/cobra"
Expand All @@ -13,6 +14,7 @@ var serviceCmd = &cobra.Command{
Long: `run service in backend.
the service will read config file, according to the config file, it do ddns resolve updating, specific interface upping and so on`,
Run: func(cmd *cobra.Command, args []string) {
conf.Init(config)
daemon.Serve()
},
}
Expand Down

0 comments on commit 63652b9

Please sign in to comment.