-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.go
29 lines (25 loc) · 1.04 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cmd
// Config is the root of a configuration file
type Config struct {
Server Server `json:"server,omitempty" mapstructure:"server"`
Proxies map[string]string `json:"proxies,omitempty" mapstructure:"proxies"`
Profiles map[string]Profile `json:"profiles,omitempty" mapstructure:"profiles"`
}
// Server represents a Sweetcher server configuration file
type Server struct {
Logs struct {
Level string `json:"level,omitempty" mapstructure:"level"`
} `json:"logs,omitempty" mapstructure:"logs"`
Address string `json:"address,omitempty" mapstructure:"address"`
Profile string `json:"profile,omitempty" mapstructure:"profile"`
}
// Profile represents a Profile definition
type Profile struct {
Default string `json:"default,omitempty" mapstructure:"default"`
Rules []Rule `json:"rules,omitempty" mapstructure:"rules"`
}
// Rule is a routing rule to a proxy
type Rule struct {
HostWildcard string `json:"host_wildcard,omitempty" mapstructure:"host_wildcard"`
Proxy string `json:"proxy,omitempty" mapstructure:"proxy"`
}