Skip to content

Commit

Permalink
Merge pull request #136 from taosdata/fix/oem
Browse files Browse the repository at this point in the history
fix oem issue
  • Loading branch information
sheyanjie-qq authored Aug 14, 2024
2 parents 221f568 + c2439d0 commit 578475f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions infrastructure/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/taosdata/taoskeeper/version"
)

var Name = "taoskeeper"
var Name = fmt.Sprintf("%skeeper", version.CUS_PROMPT)

type Config struct {
Cors web.CorsConfig `toml:"cors"`
Expand Down Expand Up @@ -60,24 +60,24 @@ func InitConfig() *Config {
cp = pflag.StringP("config", "c", "", fmt.Sprintf("config path default /etc/%s/%s.toml", version.CUS_PROMPT, Name))
}

transfer := pflag.StringP("transfer", "", "", "run taoskeeper in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit")
transfer := pflag.StringP("transfer", "", "", "run "+Name+" in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit")
fromTime := pflag.StringP("fromTime", "", "2020-01-01T00:00:00+08:00", "parameter of transfer, example: 2020-01-01T00:00:00+08:00")
drop := pflag.StringP("drop", "", "", "run taoskeeper in command mode, only support old_taosd_metric_stables. ")
drop := pflag.StringP("drop", "", "", "run "+Name+" in command mode, only support old_taosd_metric_stables. ")

v := pflag.BoolP("version", "V", false, "Print the version and exit")
help := pflag.BoolP("help", "h", false, "Print this help message and exit")

pflag.Parse()

if *help {
fmt.Fprintf(os.Stderr, "Usage of taosKeeper v%s:\n", version.Version)
fmt.Fprintf(os.Stderr, "Usage of %s v%s:\n", Name, version.Version)
pflag.CommandLine.SortFlags = false
pflag.PrintDefaults()
os.Exit(0)
}

if *v {
fmt.Printf("taoskeeper version: %s\n", version.Version)
fmt.Printf("%s version: %s\n", Name, version.Version)
fmt.Printf("git: %s\n", version.Gitinfo)
fmt.Printf("build: %s\n", version.BuildInfo)
os.Exit(0)
Expand All @@ -87,7 +87,7 @@ func InitConfig() *Config {
viper.SetConfigFile(*cp)
}

viper.SetEnvPrefix("taoskeeper")
viper.SetEnvPrefix(Name)
err := viper.BindPFlags(pflag.CommandLine)
if err != nil {
panic(err)
Expand Down
5 changes: 4 additions & 1 deletion infrastructure/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import (
"path"
"sync"
"time"

rotatelogs "github.com/huskar-t/file-rotatelogs/v2"
"github.com/sirupsen/logrus"
"github.com/taosdata/taoskeeper/infrastructure/config"

"github.com/taosdata/taoskeeper/version"
)

var logger = logrus.New()
Expand Down Expand Up @@ -114,7 +117,7 @@ func ConfigLog() {
panic(err)
}
writer, err := rotatelogs.New(
path.Join(config.Conf.Log.Path, fmt.Sprintf("taoskeeper_%%Y_%%m_%%d_%%H_%%M.log")),
path.Join(config.Conf.Log.Path, fmt.Sprintf("%skeeper_%%Y_%%m_%%d_%%H_%%M.log", version.CUS_PROMPT)),
rotatelogs.WithRotationCount(config.Conf.Log.RotationCount),
rotatelogs.WithRotationTime(config.Conf.Log.RotationTime),
rotatelogs.WithRotationSize(int64(config.Conf.Log.RotationSize)),
Expand Down

0 comments on commit 578475f

Please sign in to comment.