Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scheme option to bosun toml #2209

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/bosun/bosun.example.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Note: This file is tested as part of Bosun's tests. Editing outside of comments
# may cause tests to fail

# Scheme will be used with Hostname when links are created in templates (i.e. acknowledge links)
Scheme = "https"

# Hostname will be used when links are created in templates (i.e. acknowledge links)
Hostname = "bosun.example.com"

Expand Down
4 changes: 3 additions & 1 deletion cmd/bosun/conf/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type SystemConf struct {
TLSKeyFile string

Hostname string
Scheme string // default http
Ping bool
PingDuration Duration // Duration from now to stop pinging hosts based on time since the host tag was touched
TimeAndDate []int // timeanddate.com cities list
Expand Down Expand Up @@ -222,6 +223,7 @@ const (
// NewSystemConf retruns a system conf with default values set
func newSystemConf() *SystemConf {
return &SystemConf{
Scheme: "http",
CheckFrequency: Duration{Duration: time.Minute * 5},
DefaultRunEvery: 1,
HTTPListen: defaultHTTPListen,
Expand Down Expand Up @@ -539,7 +541,7 @@ func (sc *SystemConf) AnnotateEnabled() bool {
// MakeLink creates a HTML Link based on Bosun's configured Hostname
func (sc *SystemConf) MakeLink(path string, v *url.Values) string {
u := url.URL{
Scheme: "http",
Scheme: sc.Scheme,
Host: sc.Hostname,
Path: path,
RawQuery: v.Encode(),
Expand Down
1 change: 1 addition & 0 deletions cmd/bosun/conf/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestSystemToml(t *testing.T) {
return
}
assert.Equal(t, sc.Hostname, "bosun.example.com", "Hostname not equal")
assert.Equal(t, sc.Scheme, "https", "Scheme does not match")
assert.Equal(t, sc.DefaultRunEvery, 5)
assert.Equal(t, sc.CheckFrequency, Duration{time.Minute})
assert.Equal(t, sc.Ping, true)
Expand Down