proxy: start on api and caddy based proxy
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
15619b08f8
commit
a89aa40dda
24 changed files with 461 additions and 48 deletions
|
@ -2,6 +2,6 @@ package config
|
|||
|
||||
// Config is the top level configuration
|
||||
type Config struct {
|
||||
ListenAddr string
|
||||
EnableMetrics bool
|
||||
ListenAddr string
|
||||
SocketPath string
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue