config

package
v2.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAwsSdkConfig

func GetAwsSdkConfig(conf AWSSDKConfig) (*aws.Config, error)

func LoadConfig

func LoadConfig[E any]() (*E, error)

Types

type AMQPConnection

type AMQPConnection struct {
	BasicConnection `mapstructure:",squash"`
	Exchange        string                  `mapstructure:"exchange"`
	Protocol        AMQPProtocol            `mapstructure:"protocol"`
	BasicAuth       AMQPConnectionBasicAuth `mapstructure:"basic_auth"`
	ClientTLSAuth   struct {
		Enabled  bool   `mapstructure:"enabled"`
		CertFile string `mapstructure:"cert_file"`
		KeyFile  string `mapstructure:"key_file"`
	} `mapstructure:"client_tls_auth"`
}

type AMQPConnectionBasicAuth

type AMQPConnectionBasicAuth struct {
	Enabled  bool     `mapstructure:"enabled"`
	Username string   `mapstructure:"username"`
	Password Password `mapstructure:"password"`
}

type AMQPProtocol

type AMQPProtocol string
const (
	AMQP  AMQPProtocol = "amqp"
	AMQPS AMQPProtocol = "amqps"
)

type AWSCryptoEngine

type AWSCryptoEngine struct {
	AWSSDKConfig `mapstructure:",squash"`
	ID           string                 `mapstructure:"id"`
	Metadata     map[string]interface{} `mapstructure:"metadata"`
}

type AWSSDKConfig

type AWSSDKConfig struct {
	EndpointURL     string   `mapstructure:"endpoint_url"`
	AccessKeyID     string   `mapstructure:"access_key_id"`
	SecretAccessKey Password `mapstructure:"secret_access_key"`
	Region          string   `mapstructure:"region"`
}

type AlertsConfig

type AlertsConfig struct {
	BaseConfig `mapstructure:",squash"`
	Storage    PluggableStorageEngine `mapstructure:"storage"`
	SMTPConfig SMTPServer             `mapstructure:"smtp_server"`
}

type AuthJWTOptions

type AuthJWTOptions struct {
	ClientID         string   `mapstructure:"oidc_client_id"`
	ClientSecret     Password `mapstructure:"oidc_client_secret"`
	OIDCWellKnownURL string   `mapstructure:"oidc_well_known"`
}

type AuthMTLSOptions

type AuthMTLSOptions struct {
	CertFile string `mapstructure:"cert_file"`
	KeyFile  string `mapstructure:"key_file"`
}

type BaseConfig

type BaseConfig struct {
	// Defines logging options
	Logs BaseConfigLogging `mapstructure:"logs"`

	// Http server configuration options
	Server HttpServer `mapstructure:"server"`

	// AMQP config options.
	EventBus EventBusEngine `mapstructure:"event_bus"`
}

type BaseConfigLogging

type BaseConfigLogging struct {
	Level LogLevel `mapstructure:"level"`
}

type BasicConnection

type BasicConnection struct {
	Hostname  string `mapstructure:"hostname"`
	Port      int    `mapstructure:"port"`
	TLSConfig `mapstructure:",squash"`
}

type CAClient

type CAClient struct {
	HTTPClient `mapstructure:",squash"`
}

type CAConfig

type CAConfig struct {
	BaseConfig       `mapstructure:",squash"`
	Storage          PluggableStorageEngine `mapstructure:"storage"`
	CryptoEngines    CryptoEngines          `mapstructure:"crypto_engines"`
	CryptoMonitoring CryptoMonitoring       `mapstructure:"crypto_monitoring"`
	VAServerDomain   string                 `mapstructure:"va_server_domain"`
}

type CouchDBPSEConfig

type CouchDBPSEConfig struct {
	HTTPConnection `mapstructure:",squash"`
	Username       string   `mapstructure:"username"`
	Password       Password `mapstructure:"password"`
}

type CryptoEngines

type CryptoEngines struct {
	LogLevel                  LogLevel                           `mapstructure:"log_level"`
	DefaultEngine             string                             `mapstructure:"default_id"`
	PKCS11Provider            []PKCS11EngineConfig               `mapstructure:"pkcs11"`
	HashicorpVaultKV2Provider []HashicorpVaultCryptoEngineConfig `mapstructure:"hashicorp_vault"`
	AWSKMSProvider            []AWSCryptoEngine                  `mapstructure:"aws_kms"`
	AWSSecretsManagerProvider []AWSCryptoEngine                  `mapstructure:"aws_secrets_manager"`
	GolangProvider            []GolangEngineConfig               `mapstructure:"golang"`
}

type CryptoMonitoring

type CryptoMonitoring struct {
	Enabled   bool   `mapstructure:"enabled"`
	Frequency string `mapstructure:"frequency"`
}

type DMSconfig

type DMSconfig struct {
	BaseConfig `mapstructure:",squash"`
	Storage    PluggableStorageEngine `mapstructure:"storage"`

	CAClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"ca_client"`

	DevManagerClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"device_manager_client"`

	DownstreamCertificateFile string `mapstructure:"downstream_cert_file"`
}

type DeviceManagerConfig

type DeviceManagerConfig struct {
	BaseConfig `mapstructure:",squash"`
	Storage    PluggableStorageEngine `mapstructure:"storage"`

	CAClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"ca_client"`
}

type EventBusEngine added in v2.4.1

type EventBusEngine struct {
	LogLevel LogLevel `mapstructure:"log_level"`
	Enabled  bool     `mapstructure:"enabled"`

	Provider EventBusProvider `mapstructure:"provider"`

	Amqp      AMQPConnection `mapstructure:"amqp"`
	AWSSqsSns AMQPConnection `mapstructure:"aws_sqs_sns"`
}

type EventBusProvider added in v2.4.1

type EventBusProvider string
const (
	Amqp      EventBusProvider = "amqp"
	AWSSqsSns EventBusProvider = "aws_sqs_sns"
)

type GolangEngineConfig

type GolangEngineConfig struct {
	ID               string                 `mapstructure:"id"`
	Metadata         map[string]interface{} `mapstructure:"metadata"`
	StorageDirectory string                 `mapstructure:"storage_directory"`
}

type HTTPClient

type HTTPClient struct {
	LogLevel        LogLevel             `mapstructure:"log_level"`
	AuthMode        HTTPClientAuthMethod `mapstructure:"auth_mode"`
	AuthJWTOptions  AuthJWTOptions       `mapstructure:"jwt_options"`
	AuthMTLSOptions AuthMTLSOptions      `mapstructure:"mtls_options"`
	HTTPConnection  `mapstructure:",squash"`
}

type HTTPClientAuthMethod

type HTTPClientAuthMethod string
const (
	JWT    HTTPClientAuthMethod = "jwt"
	MTLS   HTTPClientAuthMethod = "mtls"
	NoAuth HTTPClientAuthMethod = "noauth"
)

type HTTPConnection

type HTTPConnection struct {
	Protocol        HTTPProtocol `mapstructure:"protocol"`
	BasePath        string       `mapstructure:"base_path"`
	BasicConnection `mapstructure:",squash"`
}

type HTTPProtocol

type HTTPProtocol string
const (
	HTTPS HTTPProtocol = "https"
	HTTP  HTTPProtocol = "http"
)

type HashicorpVaultCryptoEngineConfig

type HashicorpVaultCryptoEngineConfig struct {
	HashicorpVaultSDK `mapstructure:",squash"`
	ID                string                 `mapstructure:"id"`
	Metadata          map[string]interface{} `mapstructure:"metadata"`
}

type HashicorpVaultSDK

type HashicorpVaultSDK struct {
	RoleID            string     `mapstructure:"role_id"`
	SecretID          Password   `mapstructure:"secret_id"`
	AutoUnsealEnabled bool       `mapstructure:"auto_unseal_enabled"`
	AutoUnsealKeys    []Password `mapstructure:"auto_unseal_keys"`
	MountPath         string     `mapstructure:"mount_path"`
	HTTPConnection    `mapstructure:",squash"`
}

type HttpServer

type HttpServer struct {
	LogLevel           LogLevel                 `mapstructure:"log_level"`
	HealthCheckLogging bool                     `mapstructure:"health_check"`
	ListenAddress      string                   `mapstructure:"listen_address"`
	Port               int                      `mapstructure:"port"`
	Protocol           HTTPProtocol             `mapstructure:"protocol"`
	CertFile           string                   `mapstructure:"cert_file"`
	KeyFile            string                   `mapstructure:"key_file"`
	Authentication     HttpServerAuthentication `mapstructure:"authentication"`
}

type HttpServerAuthentication added in v2.4.4

type HttpServerAuthentication struct {
	MutualTLS HttpServerMutualTLSAuthentication `mapstructure:"mutual_tls"`
}

type HttpServerMutualTLSAuthentication added in v2.4.4

type HttpServerMutualTLSAuthentication struct {
	Enabled           bool          `mapstructure:"enabled"`
	ValidationMode    MutualTLSMode `mapstructure:"validation_mode"`
	CACertificateFile string        `mapstructure:"ca_cert_file"`
}

type IotAWS

type IotAWS struct {
	BaseConfig `mapstructure:",squash"`

	DMSManagerClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"dms_manager_client"`

	DevManagerClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"device_manager_client"`

	CAClient struct {
		HTTPClient `mapstructure:",squash"`
	} `mapstructure:"ca_client"`

	ConnectorID  string       `mapstructure:"connector_id"`
	AWSSDKConfig AWSSDKConfig `mapstructure:"aws_config"`
}

type LamassuMonolithicAssembleMode

type LamassuMonolithicAssembleMode string
const (
	//all Lamassu service but the proxy server are deployed in memory. If services interact between them,
	//they do so by using each other's Business Logic (aka Service).
	InMemory LamassuMonolithicAssembleMode = "IN_MEMORY"
	//each Lamassu service is deployed as separate HTTP servers. If services interact between them, HTTP clients (SDKs) are used
	Http LamassuMonolithicAssembleMode = "HTTP"
)

type LogLevel

type LogLevel string
const (
	Info  LogLevel = "info"
	Debug LogLevel = "debug"
	Trace LogLevel = "trace"
	None  LogLevel = "none"
)

type MonolithicAWSIoTManagerConfig

type MonolithicAWSIoTManagerConfig struct {
	Enabled      bool         `mapstructure:"enabled"`
	ConnectorID  string       `mapstructure:"connector_id"`
	AWSSDKConfig AWSSDKConfig `mapstructure:"aws_config"`
}

type MonolithicConfig

type MonolithicConfig struct {
	BaseConfig       `mapstructure:",squash"`
	Storage          PluggableStorageEngine        `mapstructure:"storage"`
	CryptoEngines    CryptoEngines                 `mapstructure:"crypto_engines"`
	CryptoMonitoring CryptoMonitoring              `mapstructure:"crypto_monitoring"`
	Domain           string                        `mapstructure:"domain"`
	AssemblyMode     LamassuMonolithicAssembleMode `mapstructure:"assembly_mode"`
	GatewayPort      int                           `mapstructure:"gateway_port"`
	AWSIoTManager    MonolithicAWSIoTManagerConfig `mapstructure:"aws_iot_manager"`
}

type MutualTLSMode

type MutualTLSMode string
const (
	Strict  MutualTLSMode = "strict"
	Request MutualTLSMode = "request"
	Any     MutualTLSMode = "any"
)

type PKCS11Config

type PKCS11Config struct {
	TokenLabel         string                   `mapstructure:"token"`
	TokenPin           Password                 `mapstructure:"pin"`
	ModulePath         string                   `mapstructure:"module_path"`
	ModuleExtraOptions PKCS11ModuleExtraOptions `mapstructure:"module_extra_options"`
}

type PKCS11EngineConfig

type PKCS11EngineConfig struct {
	PKCS11Config `mapstructure:",squash"`
	ID           string                 `mapstructure:"id"`
	Metadata     map[string]interface{} `mapstructure:"metadata"`
}

type PKCS11ModuleExtraOptions

type PKCS11ModuleExtraOptions struct {
	Env map[string]string `mapstructure:"env"`
}

type Password

type Password string

func (Password) MarshalText

func (p Password) MarshalText() ([]byte, error)

func (*Password) UnmarshalText

func (p *Password) UnmarshalText(text []byte) (err error)

type PluggableStorageEngine

type PluggableStorageEngine struct {
	LogLevel LogLevel `mapstructure:"log_level"`

	Provider StorageProvider `mapstructure:"provider"`

	CouchDB  CouchDBPSEConfig  `mapstructure:"couch_db"`
	Postgres PostgresPSEConfig `mapstructure:"postgres"`
}

type PostgresPSEConfig

type PostgresPSEConfig struct {
	Hostname string   `mapstructure:"hostname"`
	Port     int      `mapstructure:"port"`
	Username string   `mapstructure:"username"`
	Password Password `mapstructure:"password"`
}

type SMTPServer

type SMTPServer struct {
	From     string `json:"from"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	SSL      bool   `json:"ssl"`
	Insecure bool   `json:"insecure"`
}

type StorageProvider

type StorageProvider string
const (
	Postgres StorageProvider = "postgres"
	CouchDB  StorageProvider = "couch_db"
	DynamoDB StorageProvider = "dynamo_db"
)

type TLSConfig

type TLSConfig struct {
	InsecureSkipVerify bool   `mapstructure:"insecure_skip_verify"`
	CACertificateFile  string `mapstructure:"ca_cert_file"`
}

type VAconfig

type VAconfig struct {
	BaseConfig `mapstructure:",squash"`

	CAClient CAClient `mapstructure:"ca_client"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL