Add YAML Support (#86)

This commit is contained in:
Monsoon 2020-12-25 03:30:26 +08:00 committed by GitHub
parent f073456ac0
commit 85619b5a29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 96 additions and 0 deletions

View file

@ -152,6 +152,8 @@ func getConfigFilePath() cmdarg.Arg {
func getConfigFormat() string {
switch strings.ToLower(*format) {
case "yaml", "yml":
return "yaml"
case "pb", "protobuf":
return "protobuf"
case "toml":
@ -165,6 +167,9 @@ func startXray() (core.Server, error) {
configFiles := getConfigFilePath()
config, err := core.LoadConfig(getConfigFormat(), configFiles[0], configFiles)
//config, err := core.LoadConfigs(getConfigFormat(), configFiles)
if err != nil {
return nil, newError("failed to load config files: [", configFiles.String(), "]").Base(err)
}