mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-12-12 20:49:48 +04:00
Commands/run: Try all suffixes for default config
This commit is contained in:
@@ -182,7 +182,9 @@ func getConfigFilePath(verbose bool) cmdarg.Arg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if workingDir, err := os.Getwd(); err == nil {
|
if workingDir, err := os.Getwd(); err == nil {
|
||||||
configFile := filepath.Join(workingDir, "config.json")
|
suffixes := []string{".json", ".jsonc", ".toml", ".yaml", ".yml"}
|
||||||
|
for _, suffix := range suffixes {
|
||||||
|
configFile := filepath.Join(workingDir, "config"+suffix)
|
||||||
if fileExists(configFile) {
|
if fileExists(configFile) {
|
||||||
if verbose {
|
if verbose {
|
||||||
log.Println("Using default config: ", configFile)
|
log.Println("Using default config: ", configFile)
|
||||||
@@ -190,6 +192,7 @@ func getConfigFilePath(verbose bool) cmdarg.Arg {
|
|||||||
return cmdarg.Arg{configFile}
|
return cmdarg.Arg{configFile}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if configFile := platform.GetConfigurationPath(); fileExists(configFile) {
|
if configFile := platform.GetConfigurationPath(); fileExists(configFile) {
|
||||||
if verbose {
|
if verbose {
|
||||||
|
|||||||
Reference in New Issue
Block a user