From 3f259323ea56642d456744990a0ab92e9a13bcf1 Mon Sep 17 00:00:00 2001 From: Jacob Baungard Hansen Date: Thu, 13 Jul 2023 11:45:02 +0200 Subject: [PATCH] Receive: Use CertificateField from Tenancy pkg These consts are now defined in the Tenancy package, so we should use those instead. Signed-off-by: Jacob Baungard Hansen --- cmd/thanos/receive.go | 2 +- pkg/receive/handler.go | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index e77af7b034..5f9405b4b4 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -876,7 +876,7 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) { cmd.Flag("receive.tenant-header", "HTTP header to determine tenant for write requests.").Default(tenancy.DefaultTenantHeader).StringVar(&rc.tenantHeader) - cmd.Flag("receive.tenant-certificate-field", "Use TLS client's certificate field to determine tenant for write requests. Must be one of "+receive.CertificateFieldOrganization+", "+receive.CertificateFieldOrganizationalUnit+" or "+receive.CertificateFieldCommonName+". This setting will cause the receive.tenant-header flag value to be ignored.").Default("").EnumVar(&rc.tenantField, "", receive.CertificateFieldOrganization, receive.CertificateFieldOrganizationalUnit, receive.CertificateFieldCommonName) + cmd.Flag("receive.tenant-certificate-field", "Use TLS client's certificate field to determine tenant for write requests. Must be one of "+tenancy.CertificateFieldOrganization+", "+tenancy.CertificateFieldOrganizationalUnit+" or "+tenancy.CertificateFieldCommonName+". This setting will cause the receive.tenant-header flag value to be ignored.").Default("").EnumVar(&rc.tenantField, "", tenancy.CertificateFieldOrganization, tenancy.CertificateFieldOrganizationalUnit, tenancy.CertificateFieldCommonName) cmd.Flag("receive.default-tenant-id", "Default tenant ID to use when none is provided via a header.").Default(tenancy.DefaultTenant).StringVar(&rc.defaultTenantID) diff --git a/pkg/receive/handler.go b/pkg/receive/handler.go index 569404630f..cc89748726 100644 --- a/pkg/receive/handler.go +++ b/pkg/receive/handler.go @@ -64,13 +64,6 @@ const ( labelError = "error" ) -// Allowed fields in client certificates. -const ( - CertificateFieldOrganization = "organization" - CertificateFieldOrganizationalUnit = "organizationalUnit" - CertificateFieldCommonName = "commonName" -) - var ( // errConflict is returned whenever an operation fails due to any conflict-type error. errConflict = errors.New("conflict")