Skip to content

service.ParsedConfig Contains returns true for optional NewObjectField #654

Description

@lublak

Currently i try to finalize my code. I created a configuration like this:

service.NewObjectField(hcFieldNegotiate,
			service.NewObjectField(hcFieldNegotiateUser,
				service.NewStringField(hcFieldNegotiateUserDomain).
					Description("The domain of the user.").
					Default(""),
				service.NewStringField(hcFieldNegotiateUserName).
					Description("The username of the user.").
					Default(""),
				service.NewStringField(hcFieldNegotiateUserPassword).
					Description("The password of the user.").
					Default(""),
			).
				Description("The user to use for the authentication. If the user is not configured, SSPI will use the currently logged-in user and Pure will use the Kerberos keytab file.").
				Optional(),

But now if i check if it exists, it results to "true":

negotiate := pConf.Namespace(hcFieldNegotiate)
if negotiate.Contains(hcFieldNegotiateUser) {
    println("no!")
}

full code:

main...lublak:bento:spnego

input:
  http_client:
    url: https://testserver/
    verb: GET
    negotiate:
      enabled: true
output:
  stdout: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions