config

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BuildViper

func BuildViper(path string) (*viper.Viper, error)

Types

type Config

type Config struct {
	GRPCServerAddress   string                            `mapstructure:"grpc_server_address"`
	OCSPServer          []string                          `mapstructure:"ocsp_server"`
	Database            DatabaseConfig                    `mapstructure:"database"`
	Redis               RedisConfig                       `mapstructure:"redis"`
	KMS                 KMSConfig                         `mapstructure:"kms"`
	Firehose            FirehoseConfig                    `mapstructure:"firehose"`
	Domains             []string                          `mapstructure:"domains"`
	ACMPCA              map[string]SubordinateCertificate `mapstructure:"acm_pca"`
	SecretsManager      SecretsManagerConfig              `mapstructure:"secrets_manager"`
	SubordinateMetadata SubordinateCertificateAuthority   `mapstructure:"subordinate_ca_metadata"`
	Environment         Stage                             `mapstructure:"certificate_authority"`
}
var Configuration *Config

func GetTestConfigurationPath

func GetTestConfigurationPath() (*Config, error)

func LoadConfig

func LoadConfig(viper *viper.Viper) (*Config, error)

type ConfigFilePathResolver

type ConfigFilePathResolver interface {
	Resolve() (string, error)
}

func ProvideConfigPathResolver

func ProvideConfigPathResolver(e Environment) ConfigFilePathResolver

type ConfigProvider

type ConfigProvider interface {
	Get(path string, cfg any) error
	Exists(path string) bool
}

func NewConfigProviderFromViper

func NewConfigProviderFromViper(v *viper.Viper) ConfigProvider

type DatabaseConfig

type DatabaseConfig struct {
	Driver         string `mapstructure:"database_driver"`
	Table          string `mapstructure:"database_table"`
	Endpoint       string `mapstructure:"database_endpoint"`
	ReaderEndpoint string `mapstructure:"database_reader_endpoint"`
	User           string `mapstructure:"database_user"`
	Port           int    `mapstructure:"database_port"`
	Region         string `mapstructure:"region"`
	SSLMode        string `mapstructure:"ssl_mode"`
}

type Environment

type Environment struct {
	Provider      string
	Stage         string
	Configuration string
}

func ProvideEnvironment

func ProvideEnvironment() Environment

type FirehoseConfig

type FirehoseConfig struct {
	Stream string `mapstructure:"stream"`
	Region string `mapstructure:"region"`
}

type KMSConfig

type KMSConfig struct {
	KeyId            string `mapstructure:"key_id"`
	SigningAlgorithm string `mapstructure:"signing_algorithm"`
	Region           string `mapstructure:"region"`
	AuthValidity     int    `mapstructure:"auth_validity"`
}

type Parameter

type Parameter struct {
	fx.In

	Environment  Environment
	PathResolver ConfigFilePathResolver
}

type RedisConfig

type RedisConfig struct {
	Endpoint         string   `mapstructure:"cluster_endpoint"`
	Port             string   `mapstructure:"port"`
	Duration         int      `mapstructure:"duration"`
	Period           int      `mapstructure:"period"`
	RateLimit        int      `mapstructure:"rate_limit"`
	ExcludeRateLimit []string `mapstructure:"exclude_rate_limit"`
}

type Resolver

type Resolver struct {
	Environment Environment
	Template    string
}

func (Resolver) Resolve

func (r Resolver) Resolve() (string, error)

type Result

type Result struct {
	fx.Out

	RawConfig      *Config
	ConfigProvider ConfigProvider
}

func ProvideConfig

func ProvideConfig(p Parameter) (Result, error)

type SecretsManagerConfig

type SecretsManagerConfig struct {
	SecretId string `mapstructure:"secret_id"`
	Region   string `mapstructure:"region"`
}

type Stage

type Stage struct {
	Local         []string `mapstructure:"local"`
	Sandbox       []string `mapstructure:"sandbox"`
	Development   []string `mapstructure:"development"`
	Staging       []string `mapstructure:"staging"`
	PreProduction []string `mapstructure:"pre_production"`
	Production    []string `mapstructure:"production"`
	Corporate     []string `mapstructure:"corporate"`
}

type SubordinateCertificate

type SubordinateCertificate struct {
	Region      string `mapstructure:"region"`
	CaArn       string `mapstructure:"ca_arn"`
	CaActiveDay int    `mapstructure:"ca_active_day"`
	AssumeRole  bool   `mapstructure:"assume_role"`
	RoleArn     string `mapstructure:"role_arn"`
	RootCa      bool   `mapstructure:"root_ca"`
	Default     bool   `mapstructure:"default"`
}

type SubordinateCertificateAuthority

type SubordinateCertificateAuthority struct {
	BaseDirectory    string `mapstructure:"directory"`
	Country          string `mapstructure:"country"`
	Province         string `mapstructure:"province"`
	Locality         string `mapstructure:"locality"`
	Organization     string `mapstructure:"organization"`
	OrganizationUnit string `mapstructure:"organization_unit"`
	Email            string `mapstructure:"email"`
	SigningAlgorithm string `mapstructure:"signing_algorithm"`
	KeyAlgorithm     string `mapstructure:"key_algorithm"`
	KeySize          int    `mapstructure:"key_size"`
}

Jump to

Keyboard shortcuts

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