1
mirror of https://github.com/XTLS/Xray-core.git synced 2025-12-12 04:34:41 +04:00
Files
xray-core/main/confloader/confloader.go
𐲓𐳛𐳪𐳂𐳐 𐲀𐳢𐳦𐳫𐳢 𐲥𐳔𐳛𐳪𐳌𐳑𐳖𐳇 aea123842b Chore: Remove ctlcmd and leftover envvar (#5392)
https://github.com/v2fly/v2ray-core/issues/360
2025-12-08 13:27:22 +00:00

28 lines
544 B
Go

package confloader
import (
"context"
"io"
"os"
"github.com/xtls/xray-core/common/errors"
)
type (
configFileLoader func(string) (io.Reader, error)
)
var (
EffectiveConfigFileLoader configFileLoader
)
// LoadConfig reads from a path/url/stdin
// actual work is in external module
func LoadConfig(file string) (io.Reader, error) {
if EffectiveConfigFileLoader == nil {
errors.LogInfo(context.Background(), "external config module not loaded, reading from stdin")
return os.Stdin, nil
}
return EffectiveConfigFileLoader(file)
}