tag HCL bookkeeping keys with json:"-" to keep them out of the api

This commit is contained in:
Lang Martin
2019-04-25 14:54:20 -04:00
parent e6d6c0afed
commit 6abbf6a1c3
5 changed files with 26 additions and 23 deletions

View File

@@ -144,7 +144,7 @@ type Config struct {
Plugins []*config.PluginConfig `hcl:"plugin"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// ClientConfig is configuration specific to the client mode
@@ -209,7 +209,7 @@ type ClientConfig struct {
// GCInterval is the time interval at which the client triggers garbage
// collection
GCInterval time.Duration
GCIntervalHCL string `hcl:"gc_interval"`
GCIntervalHCL string `hcl:"gc_interval" json:"-"`
// GCParallelDestroys is the number of parallel destroys the garbage
// collector will allow.
@@ -235,7 +235,7 @@ type ClientConfig struct {
ServerJoin *ServerJoin `hcl:"server_join"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// ACLConfig is configuration specific to the ACL system
@@ -248,14 +248,14 @@ type ACLConfig struct {
// to "30s". Reducing this impacts performance by forcing more
// frequent resolution.
TokenTTL time.Duration
TokenTTLHCL string `hcl:"token_ttl"`
TokenTTLHCL string `hcl:"token_ttl" json:"-"`
// PolicyTTL controls how long we cache ACL policies. This controls
// how stale they can be when we are enforcing policies. Defaults
// to "30s". Reducing this impacts performance by forcing more
// frequent resolution.
PolicyTTL time.Duration
PolicyTTLHCL string `hcl:"policy_ttl"`
PolicyTTLHCL string `hcl:"policy_ttl" json:"-"`
// ReplicationToken is used by servers to replicate tokens and policies
// from the authoritative region. This must be a valid management token
@@ -263,7 +263,7 @@ type ACLConfig struct {
ReplicationToken string `hcl:"replication_token"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// ServerConfig is configuration specific to the server mode
@@ -322,12 +322,12 @@ type ServerConfig struct {
// HeartbeatGrace is the grace period beyond the TTL to account for network,
// processing delays and clock skew before marking a node as "down".
HeartbeatGrace time.Duration
HeartbeatGraceHCL string `hcl:"heartbeat_grace"`
HeartbeatGraceHCL string `hcl:"heartbeat_grace" json:"-"`
// MinHeartbeatTTL is the minimum time between heartbeats. This is used as
// a floor to prevent excessive updates.
MinHeartbeatTTL time.Duration
MinHeartbeatTTLHCL string `hcl:"min_heartbeat_ttl"`
MinHeartbeatTTLHCL string `hcl:"min_heartbeat_ttl" json:"-"`
// MaxHeartbeatsPerSecond is the maximum target rate of heartbeats
// being processed per second. This allows the TTL to be increased
@@ -355,7 +355,7 @@ type ServerConfig struct {
// the default is 30s.
// Deprecated in Nomad 0.10
RetryInterval time.Duration
RetryIntervalHCL string `hcl:"retry_interval"`
RetryIntervalHCL string `hcl:"retry_interval" json:"-"`
// RejoinAfterLeave controls our interaction with the cluster after leave.
// When set to false (default), a leave causes Consul to not rejoin
@@ -381,7 +381,7 @@ type ServerConfig struct {
ServerJoin *ServerJoin `hcl:"server_join"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// ServerJoin is used in both clients and servers to bootstrap connections to
@@ -405,10 +405,10 @@ type ServerJoin struct {
// attempts on agent start. The minimum allowed value is 1 second and
// the default is 30s.
RetryInterval time.Duration
RetryIntervalHCL string `hcl:"retry_interval"`
RetryIntervalHCL string `hcl:"retry_interval" json:"-"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
func (s *ServerJoin) Merge(b *ServerJoin) *ServerJoin {
@@ -550,7 +550,7 @@ type Telemetry struct {
CirconusBrokerSelectTag string `hcl:"circonus_broker_select_tag"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// PrefixFilters parses the PrefixFilter field and returns a list of allowed and blocked filters
@@ -578,7 +578,7 @@ type Ports struct {
RPC int `hcl:"rpc"`
Serf int `hcl:"serf"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// Addresses encapsulates all of the addresses we bind to for various
@@ -588,7 +588,7 @@ type Addresses struct {
RPC string `hcl:"rpc"`
Serf string `hcl:"serf"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// AdvertiseAddrs is used to control the addresses we advertise out for
@@ -599,7 +599,7 @@ type AdvertiseAddrs struct {
RPC string `hcl:"rpc"`
Serf string `hcl:"serf"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
type Resources struct {
@@ -608,7 +608,7 @@ type Resources struct {
DiskMB int `hcl:"disk"`
ReservedPorts string `hcl:"reserved_ports"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// CanParseReserved returns if the reserved ports specification is parsable.

View File

@@ -15,12 +15,12 @@ type AutopilotConfig struct {
// in a stable, healthy state before it can be added to the cluster. Only
// applicable with Raft protocol version 3 or higher.
ServerStabilizationTime time.Duration
ServerStabilizationTimeHCL string `hcl:"server_stabilization_time"`
ServerStabilizationTimeHCL string `hcl:"server_stabilization_time" json:"-"`
// LastContactThreshold is the limit on the amount of time a server can go
// without leader contact before being considered unhealthy.
LastContactThreshold time.Duration
LastContactThresholdHCL string `hcl:"last_contact_threshold"`
LastContactThresholdHCL string `hcl:"last_contact_threshold" json:"-"`
// MaxTrailingLogs is the amount of entries in the Raft Log that a server can
// be behind before being considered unhealthy.
@@ -39,7 +39,7 @@ type AutopilotConfig struct {
EnableCustomUpgrades *bool `hcl:"enable_custom_upgrades"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// DefaultAutopilotConfig() returns the canonical defaults for the Nomad

View File

@@ -57,7 +57,7 @@ type ConsulConfig struct {
// Timeout is used by Consul HTTP Client
Timeout time.Duration
TimeoutHCL string `hcl:"timeout"`
TimeoutHCL string `hcl:"timeout" json:"-"`
// Token is used to provide a per-request ACL token. This options overrides
// the agent's default token
@@ -91,7 +91,7 @@ type ConsulConfig struct {
ClientAutoJoin *bool `hcl:"client_auto_join"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
// DefaultConsulConfig() returns the canonical defaults for the Nomad

View File

@@ -8,7 +8,7 @@ type PluginConfig struct {
Args []string `hcl:"args"`
Config map[string]interface{} `hcl:"config"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys"`
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
func (p *PluginConfig) Merge(o *PluginConfig) *PluginConfig {

View File

@@ -69,6 +69,9 @@ type TLSConfig struct {
// ciphersuite. If true then the server's preference, as expressed in
// the order of elements in CipherSuites, is used.
TLSPreferServerCipherSuites bool `hcl:"tls_prefer_server_cipher_suites"`
// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
}
type KeyLoader struct {