proxy: start on api and caddy based proxy

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2017-07-29 22:54:43 -04:00
parent 15619b08f8
commit a89aa40dda
No known key found for this signature in database
GPG key ID: A519480096146526
24 changed files with 461 additions and 48 deletions

View file

@ -2,6 +2,6 @@ package config
// Config is the top level configuration
type Config struct {
ListenAddr string
EnableMetrics bool
ListenAddr string
SocketPath string
}

View file

@ -2,6 +2,12 @@ package config
import (
"github.com/BurntSushi/toml"
"github.com/sirupsen/logrus"
)
const (
defaultListenAddr = ":8080"
defaultSocketPath = "/var/run/element.sock"
)
// ParseConfig returns a Config object from a raw string config TOML
@ -11,5 +17,15 @@ func ParseConfig(data string) (*Config, error) {
return nil, err
}
if cfg.ListenAddr == "" {
logrus.Warnf("using default listen addr: %s", defaultListenAddr)
cfg.ListenAddr = defaultListenAddr
}
if cfg.SocketPath == "" {
logrus.Warnf("using default socket path: %s", defaultSocketPath)
cfg.SocketPath = defaultSocketPath
}
return &cfg, nil
}