Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
cmd: add ability to read config from stdin (#3898)
Jordi Masip committed
Dec 3, 2020 at 18:02 UTC
e7a5a3850f09d26ddb035a8da4d233efc6a81581
1 file changed
+5
-1
cmd/main.go
+5
-1
@@ -123,7 +123,11 @@ func loadConfig(configFile, adapterName string) ([]byte, string, error) {
123
var cfgAdapter caddyconfig.Adapter
124
var err error
125
if configFile != "" {
126
- config, err = ioutil.ReadFile(configFile)
126
+ if configFile == "-" {
127
+ config, err = ioutil.ReadAll(os.Stdin)
128
+ } else {
129
+ config, err = ioutil.ReadFile(configFile)
130
+ }
131
if err != nil {
132
return nil, "", fmt.Errorf("reading config file: %v", err)
133
}