You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/09/01 10:42:00 UTC
[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #165: Add stream schema cli
hanahmily commented on code in PR #165:
URL: https://github.com/apache/skywalking-banyandb/pull/165#discussion_r960493288
##########
bydbctl/internal/cmd/root.go:
##########
@@ -30,7 +32,33 @@ func NewRoot() *cobra.Command {
DisableAutoGenTag: true,
Version: version.Build(),
Short: "bydbctl is the command line tool of BanyanDB",
+ PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
+ viper.SetConfigType("yaml")
+ viper.SetConfigName("config")
+ viper.AddConfigPath("$HOME/.bydbctl")
+ if err = viper.SafeWriteConfig(); err != nil {
+ if os.IsNotExist(err) {
+ err = viper.WriteConfig()
+ if err != nil {
+ return err
+ }
+ }
+ }
+ if err = viper.ReadInConfig(); err != nil {
+ if _, ok := err.(viper.ConfigFileNotFoundError); ok {
+ logger.GetLogger().Fatal().Err(err).Msg("Config file not found")
Review Comment:
You should create a config file if not found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org