Documentation ¶
Index ¶
Constants ¶
const DefaultServerCertFile = "hubCert.pem"
const DefaultServerKeyFile = "hubKey.pem"
const HubCoreConfigFileName = "hub.yaml"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HubCoreConfig ¶
type HubCoreConfig struct { Env utils.AppEnvironment CaCertFile string `yaml:"caCertFile"` // default: caCert.pem CaKeyFile string `yaml:"caKeyFile"` // default: caKey.pem ServerCertFile string `yaml:"serverCertFile"` // default: hubCert.pem ServerKeyFile string `yaml:"serverKeyFile"` // default: hubKey.pem CaCert *x509.Certificate `yaml:"-"` // preset, load, or error CaKey *ecdsa.PrivateKey `yaml:"-"` // preset, load, or error ServerTLS *tls.Certificate `yaml:"-"` // preset, load, or generate ServerKey *ecdsa.PrivateKey `yaml:"-"` // use either nats or mqtt. NatsServer natsmsgserver.NatsServerConfig `yaml:"natsserver"` MqttServer mqttmsgserver.MqttServerConfig `yaml:"mqttserver"` // auth service config Auth config.AuthConfig `yaml:"auth"` // enable mDNS discovery EnableMDNS bool `yaml:"enableMDNS"` }
HubCoreConfig with core server, auth, cert and launcher configuration Used for launching the core. Use NewHubCoreConfig to create a default config FIXME: this is temporary, each service must handle their own config yaml
func NewHubCoreConfig ¶
func NewHubCoreConfig() *HubCoreConfig
NewHubCoreConfig creates a new configuration for the hub server and core services. Call Setup to load a config file and update directories.
func (*HubCoreConfig) Setup ¶
func (cfg *HubCoreConfig) Setup(env *utils.AppEnvironment, core string, new bool) error
Setup ensures the hub core configuration exists along with certificate and key files. This: 1. If 'new' is true then delete existing config, certs, logs and storage. 2. Creates missing directories 3. Create missing certificates, including a self-signed CA. 4. Setup the message server config, nats or mqtt 5. Create auth keys for certs and launcher services 6. Create a default launcher config if none exists
env holds the application directory environment core holds the core to setup, "nats" or "mqtt" (default) new to initialize a new environment and delete existing data (careful!)