2016-05-22 03:15:58 +00:00
|
|
|
package config
|
|
|
|
|
2016-05-26 20:31:32 +00:00
|
|
|
import (
|
2022-02-24 14:34:54 +00:00
|
|
|
"fmt"
|
2017-05-16 19:19:16 +00:00
|
|
|
"net/http"
|
2016-06-17 05:51:06 +00:00
|
|
|
"strings"
|
2016-05-26 20:31:32 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
consul "github.com/hashicorp/consul/api"
|
2022-02-24 14:34:54 +00:00
|
|
|
"github.com/hashicorp/go-secure-stdlib/listenerutil"
|
2017-01-18 23:55:14 +00:00
|
|
|
"github.com/hashicorp/nomad/helper"
|
2016-05-26 20:31:32 +00:00
|
|
|
)
|
|
|
|
|
2016-05-22 03:15:58 +00:00
|
|
|
// ConsulConfig contains the configuration information necessary to
|
|
|
|
// communicate with a Consul Agent in order to:
|
|
|
|
//
|
2016-06-10 02:55:01 +00:00
|
|
|
// - Register services and their checks with Consul
|
2016-05-22 03:15:58 +00:00
|
|
|
//
|
|
|
|
// - Bootstrap this Nomad Client with the list of Nomad Servers registered
|
|
|
|
// with Consul
|
2016-05-23 18:09:31 +00:00
|
|
|
//
|
2020-09-04 17:50:11 +00:00
|
|
|
// - Establish how this Nomad Client will resolve Envoy Connect Sidecar
|
|
|
|
// images.
|
|
|
|
//
|
2016-05-23 18:09:31 +00:00
|
|
|
// Both the Agent and the executor need to be able to import ConsulConfig.
|
2016-05-22 03:15:58 +00:00
|
|
|
type ConsulConfig struct {
|
|
|
|
// ServerServiceName is the name of the service that Nomad uses to register
|
|
|
|
// servers with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ServerServiceName string `hcl:"server_service_name"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2018-03-20 15:03:58 +00:00
|
|
|
// ServerHTTPCheckName is the name of the health check that Nomad uses
|
2018-03-19 18:37:56 +00:00
|
|
|
// to register the server HTTP health check with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ServerHTTPCheckName string `hcl:"server_http_check_name"`
|
2018-03-19 18:37:56 +00:00
|
|
|
|
2018-03-20 15:03:58 +00:00
|
|
|
// ServerSerfCheckName is the name of the health check that Nomad uses
|
2018-03-19 18:37:56 +00:00
|
|
|
// to register the server Serf health check with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ServerSerfCheckName string `hcl:"server_serf_check_name"`
|
2018-03-19 18:37:56 +00:00
|
|
|
|
2018-03-20 15:03:58 +00:00
|
|
|
// ServerRPCCheckName is the name of the health check that Nomad uses
|
2018-03-19 18:37:56 +00:00
|
|
|
// to register the server RPC health check with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ServerRPCCheckName string `hcl:"server_rpc_check_name"`
|
2018-03-19 18:37:56 +00:00
|
|
|
|
2016-05-22 03:15:58 +00:00
|
|
|
// ClientServiceName is the name of the service that Nomad uses to register
|
|
|
|
// clients with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ClientServiceName string `hcl:"client_service_name"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2018-03-20 15:03:58 +00:00
|
|
|
// ClientHTTPCheckName is the name of the health check that Nomad uses
|
2018-03-19 18:37:56 +00:00
|
|
|
// to register the client HTTP health check with Consul
|
2019-04-04 18:16:08 +00:00
|
|
|
ClientHTTPCheckName string `hcl:"client_http_check_name"`
|
2018-03-19 18:37:56 +00:00
|
|
|
|
2019-01-09 20:38:39 +00:00
|
|
|
// Tags are optional service tags that get registered with the service
|
2019-05-14 18:37:34 +00:00
|
|
|
// in Consul
|
|
|
|
Tags []string `hcl:"tags"`
|
2019-01-09 20:38:39 +00:00
|
|
|
|
2016-06-14 19:11:38 +00:00
|
|
|
// AutoAdvertise determines if this Nomad Agent will advertise its
|
|
|
|
// services via Consul. When true, Nomad Agent will register
|
|
|
|
// services with Consul.
|
2019-04-04 18:16:08 +00:00
|
|
|
AutoAdvertise *bool `hcl:"auto_advertise"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2016-10-26 19:58:36 +00:00
|
|
|
// ChecksUseAdvertise specifies that Consul checks should use advertise
|
|
|
|
// address instead of bind address
|
2019-04-04 18:16:08 +00:00
|
|
|
ChecksUseAdvertise *bool `hcl:"checks_use_advertise"`
|
2016-10-26 19:58:36 +00:00
|
|
|
|
2019-08-27 18:34:48 +00:00
|
|
|
// Addr is the HTTP endpoint address of the local Consul agent
|
|
|
|
//
|
|
|
|
// Uses Consul's default and env var.
|
2019-04-04 18:16:08 +00:00
|
|
|
Addr string `hcl:"address"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2019-09-03 15:43:38 +00:00
|
|
|
// GRPCAddr is the gRPC endpoint address of the local Consul agent
|
|
|
|
GRPCAddr string `hcl:"grpc_address"`
|
|
|
|
|
2016-05-26 20:31:32 +00:00
|
|
|
// Timeout is used by Consul HTTP Client
|
2020-01-07 18:40:55 +00:00
|
|
|
Timeout time.Duration `hcl:"-"`
|
|
|
|
TimeoutHCL string `hcl:"timeout" json:"-"`
|
2016-05-26 20:31:32 +00:00
|
|
|
|
2016-06-14 22:21:57 +00:00
|
|
|
// Token is used to provide a per-request ACL token. This options overrides
|
2016-05-22 03:15:58 +00:00
|
|
|
// the agent's default token
|
2019-04-04 18:16:08 +00:00
|
|
|
Token string `hcl:"token"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2019-11-18 21:05:06 +00:00
|
|
|
// AllowUnauthenticated allows users to submit jobs requiring Consul
|
|
|
|
// Service Identity tokens without providing a Consul token proving they
|
|
|
|
// have access to such policies.
|
|
|
|
AllowUnauthenticated *bool `hcl:"allow_unauthenticated"`
|
|
|
|
|
2016-05-22 03:15:58 +00:00
|
|
|
// Auth is the information to use for http access to Consul agent
|
2019-04-04 18:16:08 +00:00
|
|
|
Auth string `hcl:"auth"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
// EnableSSL sets the transport scheme to talk to the Consul agent as https
|
2019-08-27 18:34:48 +00:00
|
|
|
//
|
|
|
|
// Uses Consul's default and env var.
|
2019-04-04 18:16:08 +00:00
|
|
|
EnableSSL *bool `hcl:"ssl"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2020-05-13 20:15:55 +00:00
|
|
|
// ShareSSL enables Consul Connect Native applications to use the TLS
|
|
|
|
// configuration of the Nomad Client for establishing connections to Consul.
|
|
|
|
//
|
|
|
|
// Does not include sharing of ACL tokens.
|
|
|
|
ShareSSL *bool `hcl:"share_ssl"`
|
|
|
|
|
2016-05-22 03:15:58 +00:00
|
|
|
// VerifySSL enables or disables SSL verification when the transport scheme
|
|
|
|
// for the consul api client is https
|
2019-08-27 18:34:48 +00:00
|
|
|
//
|
|
|
|
// Uses Consul's default and env var.
|
2019-04-04 18:16:08 +00:00
|
|
|
VerifySSL *bool `hcl:"verify_ssl"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
2019-08-27 18:34:48 +00:00
|
|
|
// CAFile is the path to the ca certificate used for Consul communication.
|
|
|
|
//
|
|
|
|
// Uses Consul's default and env var.
|
2019-04-04 18:16:08 +00:00
|
|
|
CAFile string `hcl:"ca_file"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
// CertFile is the path to the certificate for Consul communication
|
2019-04-04 18:16:08 +00:00
|
|
|
CertFile string `hcl:"cert_file"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
// KeyFile is the path to the private key for Consul communication
|
2019-04-04 18:16:08 +00:00
|
|
|
KeyFile string `hcl:"key_file"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
// ServerAutoJoin enables Nomad servers to find peers by querying Consul and
|
|
|
|
// joining them
|
2019-04-04 18:16:08 +00:00
|
|
|
ServerAutoJoin *bool `hcl:"server_auto_join"`
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
// ClientAutoJoin enables Nomad servers to find addresses of Nomad servers
|
|
|
|
// and register with them
|
2019-04-04 18:16:08 +00:00
|
|
|
ClientAutoJoin *bool `hcl:"client_auto_join"`
|
|
|
|
|
|
|
|
// ExtraKeysHCL is used by hcl to surface unexpected keys
|
2019-04-25 18:54:20 +00:00
|
|
|
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`
|
2020-10-02 18:46:36 +00:00
|
|
|
|
|
|
|
// Namespace sets the Consul namespace used for all calls against the
|
|
|
|
// Consul API. If this is unset, then Nomad does not specify a consul namespace.
|
|
|
|
Namespace string `hcl:"namespace"`
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 09:08:12 +00:00
|
|
|
// DefaultConsulConfig returns the canonical defaults for the Nomad
|
2019-08-27 18:34:48 +00:00
|
|
|
// `consul` configuration. Uses Consul's default configuration which reads
|
|
|
|
// environment variables.
|
2016-06-17 03:41:05 +00:00
|
|
|
func DefaultConsulConfig() *ConsulConfig {
|
2019-08-27 18:34:48 +00:00
|
|
|
def := consul.DefaultConfig()
|
2016-06-17 03:41:05 +00:00
|
|
|
return &ConsulConfig{
|
2019-11-18 21:05:06 +00:00
|
|
|
ServerServiceName: "nomad",
|
|
|
|
ServerHTTPCheckName: "Nomad Server HTTP Check",
|
|
|
|
ServerSerfCheckName: "Nomad Server Serf Check",
|
|
|
|
ServerRPCCheckName: "Nomad Server RPC Check",
|
|
|
|
ClientServiceName: "nomad-client",
|
|
|
|
ClientHTTPCheckName: "Nomad Client HTTP Check",
|
|
|
|
AutoAdvertise: helper.BoolToPtr(true),
|
|
|
|
ChecksUseAdvertise: helper.BoolToPtr(false),
|
|
|
|
ServerAutoJoin: helper.BoolToPtr(true),
|
|
|
|
ClientAutoJoin: helper.BoolToPtr(true),
|
|
|
|
AllowUnauthenticated: helper.BoolToPtr(true),
|
|
|
|
Timeout: 5 * time.Second,
|
2019-08-27 18:34:48 +00:00
|
|
|
|
|
|
|
// From Consul api package defaults
|
|
|
|
Addr: def.Address,
|
|
|
|
EnableSSL: helper.BoolToPtr(def.Scheme == "https"),
|
|
|
|
VerifySSL: helper.BoolToPtr(!def.TLSConfig.InsecureSkipVerify),
|
|
|
|
CAFile: def.TLSConfig.CAFile,
|
2020-10-02 18:46:36 +00:00
|
|
|
Namespace: def.Namespace,
|
2016-06-17 03:41:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 21:05:06 +00:00
|
|
|
// AllowsUnauthenticated returns whether the config allows unauthenticated
|
|
|
|
// creation of Consul Service Identity tokens for Consul Connect enabled Tasks.
|
2019-12-06 20:46:46 +00:00
|
|
|
//
|
|
|
|
// If allow_unauthenticated is false, the operator must provide a token on
|
2020-02-12 16:42:33 +00:00
|
|
|
// job submission (i.e. -consul-token or $CONSUL_HTTP_TOKEN).
|
2019-12-06 20:46:46 +00:00
|
|
|
func (c *ConsulConfig) AllowsUnauthenticated() bool {
|
|
|
|
return c.AllowUnauthenticated != nil && *c.AllowUnauthenticated
|
2019-11-18 21:05:06 +00:00
|
|
|
}
|
|
|
|
|
2016-05-22 03:15:58 +00:00
|
|
|
// Merge merges two Consul Configurations together.
|
2019-12-06 20:46:46 +00:00
|
|
|
func (c *ConsulConfig) Merge(b *ConsulConfig) *ConsulConfig {
|
|
|
|
result := c.Copy()
|
2016-05-22 03:15:58 +00:00
|
|
|
|
|
|
|
if b.ServerServiceName != "" {
|
|
|
|
result.ServerServiceName = b.ServerServiceName
|
|
|
|
}
|
2018-03-20 15:03:58 +00:00
|
|
|
if b.ServerHTTPCheckName != "" {
|
|
|
|
result.ServerHTTPCheckName = b.ServerHTTPCheckName
|
2018-03-19 18:37:56 +00:00
|
|
|
}
|
2018-03-20 15:03:58 +00:00
|
|
|
if b.ServerSerfCheckName != "" {
|
|
|
|
result.ServerSerfCheckName = b.ServerSerfCheckName
|
2018-03-19 18:37:56 +00:00
|
|
|
}
|
2018-03-20 15:03:58 +00:00
|
|
|
if b.ServerRPCCheckName != "" {
|
|
|
|
result.ServerRPCCheckName = b.ServerRPCCheckName
|
2018-03-19 18:37:56 +00:00
|
|
|
}
|
2016-05-22 03:15:58 +00:00
|
|
|
if b.ClientServiceName != "" {
|
|
|
|
result.ClientServiceName = b.ClientServiceName
|
|
|
|
}
|
2018-03-20 15:03:58 +00:00
|
|
|
if b.ClientHTTPCheckName != "" {
|
|
|
|
result.ClientHTTPCheckName = b.ClientHTTPCheckName
|
2018-03-19 18:37:56 +00:00
|
|
|
}
|
2019-01-09 20:38:39 +00:00
|
|
|
result.Tags = append(result.Tags, b.Tags...)
|
2017-01-18 23:55:14 +00:00
|
|
|
if b.AutoAdvertise != nil {
|
2017-02-02 19:12:07 +00:00
|
|
|
result.AutoAdvertise = helper.BoolToPtr(*b.AutoAdvertise)
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
|
|
|
if b.Addr != "" {
|
|
|
|
result.Addr = b.Addr
|
|
|
|
}
|
2019-09-03 15:43:38 +00:00
|
|
|
if b.GRPCAddr != "" {
|
|
|
|
result.GRPCAddr = b.GRPCAddr
|
|
|
|
}
|
2016-05-26 20:31:32 +00:00
|
|
|
if b.Timeout != 0 {
|
|
|
|
result.Timeout = b.Timeout
|
|
|
|
}
|
2019-06-11 19:25:56 +00:00
|
|
|
if b.TimeoutHCL != "" {
|
|
|
|
result.TimeoutHCL = b.TimeoutHCL
|
|
|
|
}
|
2016-05-22 03:15:58 +00:00
|
|
|
if b.Token != "" {
|
|
|
|
result.Token = b.Token
|
|
|
|
}
|
|
|
|
if b.Auth != "" {
|
|
|
|
result.Auth = b.Auth
|
|
|
|
}
|
2017-01-18 23:55:14 +00:00
|
|
|
if b.EnableSSL != nil {
|
2017-02-02 19:12:07 +00:00
|
|
|
result.EnableSSL = helper.BoolToPtr(*b.EnableSSL)
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
2017-01-18 23:55:14 +00:00
|
|
|
if b.VerifySSL != nil {
|
2017-02-02 19:12:07 +00:00
|
|
|
result.VerifySSL = helper.BoolToPtr(*b.VerifySSL)
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
2020-05-13 20:15:55 +00:00
|
|
|
if b.ShareSSL != nil {
|
|
|
|
result.ShareSSL = helper.BoolToPtr(*b.ShareSSL)
|
|
|
|
}
|
2016-05-22 03:15:58 +00:00
|
|
|
if b.CAFile != "" {
|
|
|
|
result.CAFile = b.CAFile
|
|
|
|
}
|
|
|
|
if b.CertFile != "" {
|
|
|
|
result.CertFile = b.CertFile
|
|
|
|
}
|
|
|
|
if b.KeyFile != "" {
|
|
|
|
result.KeyFile = b.KeyFile
|
|
|
|
}
|
2017-01-18 23:55:14 +00:00
|
|
|
if b.ServerAutoJoin != nil {
|
2017-02-02 19:12:07 +00:00
|
|
|
result.ServerAutoJoin = helper.BoolToPtr(*b.ServerAutoJoin)
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
2017-01-18 23:55:14 +00:00
|
|
|
if b.ClientAutoJoin != nil {
|
2017-02-02 19:12:07 +00:00
|
|
|
result.ClientAutoJoin = helper.BoolToPtr(*b.ClientAutoJoin)
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
2017-02-02 19:12:07 +00:00
|
|
|
if b.ChecksUseAdvertise != nil {
|
|
|
|
result.ChecksUseAdvertise = helper.BoolToPtr(*b.ChecksUseAdvertise)
|
|
|
|
}
|
2019-11-18 21:05:06 +00:00
|
|
|
if b.AllowUnauthenticated != nil {
|
|
|
|
result.AllowUnauthenticated = helper.BoolToPtr(*b.AllowUnauthenticated)
|
|
|
|
}
|
2020-10-02 18:46:36 +00:00
|
|
|
if b.Namespace != "" {
|
|
|
|
result.Namespace = b.Namespace
|
|
|
|
}
|
2017-02-02 19:12:07 +00:00
|
|
|
return result
|
2016-05-22 03:15:58 +00:00
|
|
|
}
|
2016-05-26 20:31:32 +00:00
|
|
|
|
2017-05-06 00:08:51 +00:00
|
|
|
// ApiConfig returns a usable Consul config that can be passed directly to
|
2016-05-26 20:31:32 +00:00
|
|
|
// hashicorp/consul/api. NOTE: datacenter is not set
|
|
|
|
func (c *ConsulConfig) ApiConfig() (*consul.Config, error) {
|
2017-05-16 19:19:16 +00:00
|
|
|
// Get the default config from consul to reuse things like the default
|
|
|
|
// http.Transport.
|
2016-05-26 20:31:32 +00:00
|
|
|
config := consul.DefaultConfig()
|
|
|
|
if c.Addr != "" {
|
2022-02-24 14:34:54 +00:00
|
|
|
ipStr, err := listenerutil.ParseSingleIPTemplate(c.Addr)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("unable to parse address template %q: %v", c.Addr, err)
|
|
|
|
}
|
|
|
|
config.Address = ipStr
|
2016-05-26 20:31:32 +00:00
|
|
|
}
|
|
|
|
if c.Token != "" {
|
|
|
|
config.Token = c.Token
|
|
|
|
}
|
|
|
|
if c.Timeout != 0 {
|
2017-05-30 18:59:02 +00:00
|
|
|
// Create a custom Client to set the timeout
|
2017-05-16 19:19:16 +00:00
|
|
|
if config.HttpClient == nil {
|
|
|
|
config.HttpClient = &http.Client{}
|
|
|
|
}
|
2016-05-26 20:31:32 +00:00
|
|
|
config.HttpClient.Timeout = c.Timeout
|
2017-05-16 19:19:16 +00:00
|
|
|
config.HttpClient.Transport = config.Transport
|
2016-05-26 20:31:32 +00:00
|
|
|
}
|
2016-06-17 05:51:06 +00:00
|
|
|
if c.Auth != "" {
|
|
|
|
var username, password string
|
|
|
|
if strings.Contains(c.Auth, ":") {
|
|
|
|
split := strings.SplitN(c.Auth, ":", 2)
|
|
|
|
username = split[0]
|
|
|
|
password = split[1]
|
|
|
|
} else {
|
|
|
|
username = c.Auth
|
|
|
|
}
|
|
|
|
|
|
|
|
config.HttpAuth = &consul.HttpBasicAuth{
|
|
|
|
Username: username,
|
|
|
|
Password: password,
|
|
|
|
}
|
|
|
|
}
|
2017-01-18 23:55:14 +00:00
|
|
|
if c.EnableSSL != nil && *c.EnableSSL {
|
2016-06-17 05:51:06 +00:00
|
|
|
config.Scheme = "https"
|
2017-05-15 22:32:32 +00:00
|
|
|
config.TLSConfig = consul.TLSConfig{
|
2017-01-18 23:55:14 +00:00
|
|
|
Address: config.Address,
|
|
|
|
CAFile: c.CAFile,
|
|
|
|
CertFile: c.CertFile,
|
|
|
|
KeyFile: c.KeyFile,
|
|
|
|
}
|
|
|
|
if c.VerifySSL != nil {
|
2017-05-15 22:32:32 +00:00
|
|
|
config.TLSConfig.InsecureSkipVerify = !*c.VerifySSL
|
2016-06-17 05:51:06 +00:00
|
|
|
}
|
2017-05-16 19:19:16 +00:00
|
|
|
tlsConfig, err := consul.SetupTLSConfig(&config.TLSConfig)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
config.Transport.TLSClientConfig = tlsConfig
|
2016-06-17 05:51:06 +00:00
|
|
|
}
|
2020-10-02 18:46:36 +00:00
|
|
|
if c.Namespace != "" {
|
|
|
|
config.Namespace = c.Namespace
|
|
|
|
}
|
2016-05-26 20:31:32 +00:00
|
|
|
return config, nil
|
|
|
|
}
|
2016-08-09 22:00:50 +00:00
|
|
|
|
|
|
|
// Copy returns a copy of this Consul config.
|
|
|
|
func (c *ConsulConfig) Copy() *ConsulConfig {
|
|
|
|
if c == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
nc := new(ConsulConfig)
|
|
|
|
*nc = *c
|
2017-02-02 19:12:07 +00:00
|
|
|
|
|
|
|
// Copy the bools
|
|
|
|
if nc.AutoAdvertise != nil {
|
|
|
|
nc.AutoAdvertise = helper.BoolToPtr(*nc.AutoAdvertise)
|
|
|
|
}
|
|
|
|
if nc.ChecksUseAdvertise != nil {
|
|
|
|
nc.ChecksUseAdvertise = helper.BoolToPtr(*nc.ChecksUseAdvertise)
|
|
|
|
}
|
|
|
|
if nc.EnableSSL != nil {
|
|
|
|
nc.EnableSSL = helper.BoolToPtr(*nc.EnableSSL)
|
|
|
|
}
|
|
|
|
if nc.VerifySSL != nil {
|
|
|
|
nc.VerifySSL = helper.BoolToPtr(*nc.VerifySSL)
|
|
|
|
}
|
2020-05-13 20:15:55 +00:00
|
|
|
if nc.ShareSSL != nil {
|
|
|
|
nc.ShareSSL = helper.BoolToPtr(*nc.ShareSSL)
|
|
|
|
}
|
2017-02-02 19:12:07 +00:00
|
|
|
if nc.ServerAutoJoin != nil {
|
|
|
|
nc.ServerAutoJoin = helper.BoolToPtr(*nc.ServerAutoJoin)
|
|
|
|
}
|
|
|
|
if nc.ClientAutoJoin != nil {
|
|
|
|
nc.ClientAutoJoin = helper.BoolToPtr(*nc.ClientAutoJoin)
|
|
|
|
}
|
2019-11-18 21:05:06 +00:00
|
|
|
if nc.AllowUnauthenticated != nil {
|
|
|
|
nc.AllowUnauthenticated = helper.BoolToPtr(*nc.AllowUnauthenticated)
|
|
|
|
}
|
2017-02-02 19:12:07 +00:00
|
|
|
|
2016-08-09 22:00:50 +00:00
|
|
|
return nc
|
|
|
|
}
|