diff --git a/CHANGELOG.md b/CHANGELOG.md index db9c7d0a7..f1207b2ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ ### FIXED - Fixed potential race condition when signing requests. [GH-240] +- Fixed panic when reloading configuration in single service mode [GH-247] ## v0.1.0 diff --git a/authorize/authorize.go b/authorize/authorize.go index e259dc4dc..735faa8b8 100644 --- a/authorize/authorize.go +++ b/authorize/authorize.go @@ -61,6 +61,9 @@ func (a *Authorize) ValidIdentity(route string, identity *Identity) bool { // UpdateOptions updates internal structures based on config.Options func (a *Authorize) UpdateOptions(o config.Options) error { log.Info().Msg("authorize: updating options") + if a == nil { + return nil + } a.identityAccess = NewIdentityWhitelist(o.Policies, o.Administrators) return nil } diff --git a/authorize/authorize_test.go b/authorize/authorize_test.go index 37dfb4f1e..66a92ec38 100644 --- a/authorize/authorize_test.go +++ b/authorize/authorize_test.go @@ -94,4 +94,8 @@ func Test_UpdateOptions(t *testing.T) { } }) } + + // Test nil + var a *Authorize + a.UpdateOptions(config.Options{}) } diff --git a/proxy/proxy.go b/proxy/proxy.go index a7ba6c80f..683136126 100755 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -321,5 +321,8 @@ func (p *Proxy) newReverseProxyHandler(rp *httputil.ReverseProxy, route *config. // UpdateOptions updates internal structures based on config.Options func (p *Proxy) UpdateOptions(o config.Options) error { + if p == nil { + return nil + } return p.UpdatePolicies(&o) } diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go index 2e4707a3f..c8635d0b9 100644 --- a/proxy/proxy_test.go +++ b/proxy/proxy_test.go @@ -329,4 +329,8 @@ func Test_UpdateOptions(t *testing.T) { } }) } + + // Test nil + var p *Proxy + p.UpdateOptions(config.Options{}) }