mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 10:01:11 +08:00
cmd: add ability to read config from stdin (#3898)
This commit is contained in:
parent
792fca40f1
commit
e7a5a3850f
|
@ -123,7 +123,11 @@ func loadConfig(configFile, adapterName string) ([]byte, string, error) {
|
|||
var cfgAdapter caddyconfig.Adapter
|
||||
var err error
|
||||
if configFile != "" {
|
||||
config, err = ioutil.ReadFile(configFile)
|
||||
if configFile == "-" {
|
||||
config, err = ioutil.ReadAll(os.Stdin)
|
||||
} else {
|
||||
config, err = ioutil.ReadFile(configFile)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("reading config file: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user