github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/build/build.go (about)

     1  // Copyright (c) 2017-2024, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package build
     6  
     7  import (
     8  	"strconv"
     9  )
    10  
    11  // Version the application version
    12  var Version = "0.28.0"
    13  
    14  // SHA is the git reference used to build this package
    15  var SHA = "unknown"
    16  
    17  // BuildDate is when it was build
    18  var BuildDate = "unknown"
    19  
    20  // License is the official Open Source Initiative license abbreviation
    21  const License = "Apache-2.0"
    22  
    23  // TLS controls the NATS protocol level TLS
    24  var TLS = "true"
    25  
    26  // maxBrokerClients defines the maximum clients a single choria broker will accept
    27  var maxBrokerClients = "50000"
    28  
    29  // ProvisionSecure when "false" will disable TLS provisioning mode
    30  var ProvisionSecure = "true"
    31  
    32  // ProvisionBrokerURLs defines where the daemon will connect when choria.server.provision is true
    33  var ProvisionBrokerURLs = ""
    34  
    35  // ProvisionBrokerSRVDomain defines a domain to query for provisioning brokers
    36  var ProvisionBrokerSRVDomain = ""
    37  
    38  // ProvisionModeDefault defines the value of plugin.choria.server.provision when it's not set
    39  // in the configuration file at all.
    40  var ProvisionModeDefault = "false"
    41  
    42  // ProvisionAgent determines if the supplied provisioning agent should be started
    43  // this lets you programmatically or via the additional agents system supply your own
    44  // agent to perform the provisioning duties
    45  var ProvisionAgent = "true"
    46  
    47  // ProvisionRegistrationData is a file that will be published by the registration system
    48  var ProvisionRegistrationData = ""
    49  
    50  // ProvisionFacts is a facts file to use for discovery purposes during provisioning mode
    51  var ProvisionFacts = ""
    52  
    53  // ProvisionToken when not empty this token will be required interact with the provisioner agent
    54  var ProvisionToken = ""
    55  
    56  // ProvisionJWTFile is a file holding a JWT identifying the node to the provisioner
    57  var ProvisionJWTFile = ""
    58  
    59  // ProvisionStatusFile is the file where server status will be written to while in provisioning mode
    60  var ProvisionStatusFile = ""
    61  
    62  // ProvisioningBrokerUsername is the username used to connect to the middleware with
    63  var ProvisioningBrokerUsername = ""
    64  
    65  // ProvisioningBrokerPassword is the password used to connect to the middleware with
    66  var ProvisioningBrokerPassword = ""
    67  
    68  // ProvisioningUsesProtocolV2 indicates if provisioning should use v2 protocol
    69  var ProvisioningUsesProtocolV2 = "false"
    70  
    71  // ProvisionAllowServerUpdate allows over the air updates of the choria version from provisioner
    72  var ProvisionAllowServerUpdate = "false"
    73  
    74  // AgentProviders are registered systems capable of extending choria with new agents
    75  var AgentProviders = []string{}
    76  
    77  // MachineWatchers are registered Autonomous Agent watchers
    78  var MachineWatchers = []string{}
    79  
    80  // Machines are registered Autonomous Agents
    81  var Machines = []string{}
    82  
    83  // DataProviders are registered Data plugins
    84  var DataProviders = []string{}
    85  
    86  // DefaultCollectives is the names of the default list of collectives as comma separated strings
    87  var DefaultCollectives = "mcollective"
    88  
    89  // ClientIdentitySuffix is the string to be suffixed when creating client identities
    90  var ClientIdentitySuffix = "mcollective"
    91  
    92  // HasTLS determines if TLS should be used on the wire
    93  func HasTLS() bool {
    94  	return TLS == "true"
    95  }
    96  
    97  // MaxBrokerClients is the maximum number of clients the network broker may handle
    98  func MaxBrokerClients() int {
    99  	c, err := strconv.Atoi(maxBrokerClients)
   100  	if err != nil {
   101  		return 50000
   102  	}
   103  
   104  	return c
   105  }
   106  
   107  // ProvisionDefault defines the value of plugin.choria.server.provision when it's not set
   108  // in the configuration file at all.
   109  func ProvisionDefault() bool {
   110  	return ProvisionModeDefault == "true"
   111  }
   112  
   113  // ProvisionSecurity determines if TLS should be enabled during provisioning
   114  func ProvisionSecurity() bool {
   115  	return ProvisionSecure == "true"
   116  }