mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
Change name of public function
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -37,12 +37,13 @@ import (
|
||||
|
||||
var allowUnknownTopLevelField = int32(0)
|
||||
|
||||
// AllowUnknownTopLevelConfigurationField sets if the processing of a
|
||||
// configuration file returns an error if it finds an unknown top-level
|
||||
// configuration option.
|
||||
func AllowUnknownTopLevelConfigurationField(allow bool) {
|
||||
// NoErrOnUnknownFields can be used to change the behavior the processing
|
||||
// of a configuration file. By default, an error is reported if unknown
|
||||
// fields are found. If `noError` is set to true, no error will be reported
|
||||
// if top-level unknown fields are found.
|
||||
func NoErrOnUnknownFields(noError bool) {
|
||||
var val int32
|
||||
if allow {
|
||||
if noError {
|
||||
val = int32(1)
|
||||
}
|
||||
atomic.StoreInt32(&allowUnknownTopLevelField, val)
|
||||
|
||||
@@ -1836,8 +1836,8 @@ func TestHandleUnknownTopLevelConfigurationField(t *testing.T) {
|
||||
}
|
||||
|
||||
// Verify that if that is set, we get no error
|
||||
AllowUnknownTopLevelConfigurationField(true)
|
||||
defer AllowUnknownTopLevelConfigurationField(false)
|
||||
NoErrOnUnknownFields(true)
|
||||
defer NoErrOnUnknownFields(false)
|
||||
|
||||
if err := opts.ProcessConfigFile(conf); err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user