mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 21:02:11 +08:00
refactor: cmd update.
This commit is contained in:
parent
ba25beff94
commit
3756ba90a6
@ -15,7 +15,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
@ -84,7 +83,7 @@ func NewRootCmd(processName string, opts ...func(*CmdOpts)) *RootCmd {
|
||||
|
||||
func (r *RootCmd) persistentPreRun(cmd *cobra.Command, opts ...func(*CmdOpts)) error {
|
||||
cmdOpts := r.applyOptions(opts...)
|
||||
log.CInfo(context.Background(), "config", cmdOpts.configMap)
|
||||
fmt.Println("config", cmdOpts.configMap)
|
||||
if err := r.initializeConfiguration(cmd, cmdOpts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/openimsdk/tools/errs"
|
||||
"github.com/openimsdk/tools/log"
|
||||
"github.com/spf13/viper"
|
||||
"strings"
|
||||
)
|
||||
@ -25,6 +24,6 @@ func LoadConfig(path string, envPrefix string, config any) error {
|
||||
}); err != nil {
|
||||
return errs.WrapMsg(err, "failed to unmarshal config", "path", path, "envPrefix", envPrefix)
|
||||
}
|
||||
log.CInfo(context.Background(), "Load config success", "path", path, "envPrefix", envPrefix, "config", config)
|
||||
fmt.Print("Load config success", "path", path, "envPrefix", envPrefix, "config", config)
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user