diff options
author | Jordi Masip <masipcat@users.noreply.github.com> | 2020-12-03 18:02:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 10:02:18 -0700 |
commit | e7a5a3850f09d26ddb035a8da4d233efc6a81581 (patch) | |
tree | 90c1aeb7c9eca577e67bb89aab18b67de835695f | |
parent | 792fca40f18b7c528b00a7dea508bdfd0821dd8c (diff) |
cmd: add ability to read config from stdin (#3898)
-rw-r--r-- | cmd/main.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/main.go b/cmd/main.go index e92e71f..2dfb867 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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) } |