add http flag for admin partition (#10683)

This commit is contained in:
Dhia Ayachi 2021-07-22 16:46:02 -04:00 committed by GitHub
parent b2facb35a9
commit c4911cc3ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -81,10 +81,7 @@ func (f *HTTPFlags) MultiTenancyFlags() *flag.FlagSet {
"Specifies the namespace to query. If not provided, the namespace will be inferred "+ "Specifies the namespace to query. If not provided, the namespace will be inferred "+
"from the request's ACL token, or will default to the `default` namespace. "+ "from the request's ACL token, or will default to the `default` namespace. "+
"Namespaces are a Consul Enterprise feature.") "Namespaces are a Consul Enterprise feature.")
fs.Var(&f.partition, "partition", f.AddPartitionFlag(fs)
"Specifies the admin partition to query. If not provided, the admin partition will be inferred "+
"from the request's ACL token, or will default to the `default` admin partition. "+
"Admin Partitions are a Consul Enterprise feature.")
return fs return fs
} }
@ -152,4 +149,12 @@ func (f *HTTPFlags) MergeOntoConfig(c *api.Config) {
f.tlsServerName.Merge(&c.TLSConfig.Address) f.tlsServerName.Merge(&c.TLSConfig.Address)
f.datacenter.Merge(&c.Datacenter) f.datacenter.Merge(&c.Datacenter)
f.namespace.Merge(&c.Namespace) f.namespace.Merge(&c.Namespace)
f.partition.Merge(&c.Partition)
}
func (f *HTTPFlags) AddPartitionFlag(fs *flag.FlagSet) {
fs.Var(&f.partition, "partition",
"Specifies the admin partition to query. If not provided, the admin partition will be inferred "+
"from the request's ACL token, or will default to the `default` admin partition. "+
"Admin Partitions are a Consul Enterprise feature.")
} }