Skip to content

Commit

Permalink
cmd: add ability to read config from stdin (#3898)
Browse files Browse the repository at this point in the history
  • Loading branch information
masipcat authored Dec 3, 2020
1 parent 792fca4 commit e7a5a38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e7a5a38

Please sign in to comment.