Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/ts 4433 #77

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion infrastructure/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"os"
"runtime"

"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down Expand Up @@ -42,7 +43,16 @@ func InitConfig() *Config {
viper.SetConfigName(Name)
viper.AddConfigPath("/etc/taos")

cp := pflag.StringP("c", "c", "", "taoskeeper config file")
var cp *string
switch runtime.GOOS {
case "windows":
viper.AddConfigPath(fmt.Sprintf("C:\\%s\\cfg", Name))
cp = pflag.StringP("c", "c", "", fmt.Sprintf("config path default C:\\%s\\cfg\\%s.toml", "TDengine", Name))
default:
viper.AddConfigPath(fmt.Sprintf("/etc/%s", Name))
cp = pflag.StringP("c", "c", "", fmt.Sprintf("config path default /etc/%s/%s.toml", "taos", Name))
}

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()
Expand Down
Loading