config

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadTimeOutDefault       = 30
	WriteTimeOutDefault      = 0
	ReadHeaderTimeoutDefault = 10
	MaxHeaderBytesDefault    = 1048576
	MaxRequestBytesDefault   = 256
	DynamoDBTimeoutDefault   = 60
	IntervalDefault          = 60
	DelayDefault             = 5
	LogLevelDefault          = "info"
	LogFormtDefault          = "json"
	ExpirationDefault        = "ignore"
)

Default values.

Variables

This section is empty.

Functions

This section is empty.

Types

type CADBType

type CADBType int

Supported CA DB type.

const (
	// File DB.
	FileDBType CADBType = iota
	// DynamoDB.
	DynamoDBType
)

type ConfigYAML

type ConfigYAML struct {
	Version    string `yaml:"version"`
	Strict     bool   `yaml:"strict"`
	Expiration string `yaml:"expiration"`
	Log        struct {
		Level  string `yaml:"level"`
		Format string `yaml:"format"`
	} `yaml:"log"`
	Responder struct {
		CA          string `yaml:"ca"`
		Certificate string `yaml:"responder_certificate"`
		Key         string `yaml:"responder_key"`
		Issuer      string `yaml:"issuer_certificate"`
	} `yaml:"responder"`
	Cache struct {
		Interval *int `yaml:"interval"`
		Delay    *int `yaml:"delay"`
	} `yaml:"cache"`
	DB struct {
		DynamoDB *struct {
			Region           string `yaml:"region"`
			TableName        string `yaml:"table_name"`
			CAGsi            string `yaml:"ca_gsi"`
			Endpoint         string `yaml:"endpoint"`
			RetryMaxAttempts *int   `yaml:"retry_max_attempts"`
			Timeout          *int   `yaml:"timeout"`
		} `yaml:"dynamodb"`
		FileDB *struct {
			File string `yaml:"file"`
		} `yaml:"file"`
	} `yaml:"db"`
	HTTP struct {
		Port               string `yaml:"port"`
		Domain             string `yaml:"domain"`
		ReadTimeout        *int   `yaml:"read_timeout"`
		WriteTimeout       *int   `yaml:"write_timeout"`
		ReadHeaderTimeout  *int   `yaml:"read_header_timeout"`
		MaxHeaderBytes     *int   `yaml:"max_header_bytes"`
		MaxRequestBytes    *int   `yaml:"max_request_bytes"`
		CacheControlMaxAge *int   `yaml:"cache_control_max_age"`
	} `yaml:"http"`
}

The ConfigYAML is a configuration file in YAML format. To indicate a non-specified status, the member of type int should be a pointer. This struct instance verifies the instance's own members and creates a DyOCSPConfig object based on the instance's attributes.

func (ConfigYAML) Verify

func (y ConfigYAML) Verify(cfg DyOCSPConfig) (DyOCSPConfig, []error)

Verify verifies the configuration root '.' using the ConfigYAML.Verify* methods. If it detects any invalid parameters, it returns an error slice. If there are no errors, it returns nil.

func (ConfigYAML) VerifyCacheConfig

func (y ConfigYAML) VerifyCacheConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyCacheConfig verifies .Caches.

func (ConfigYAML) VerifyDBConfig

func (y ConfigYAML) VerifyDBConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyDBConfig verifies .DB.

func (ConfigYAML) VerifyDynamoDBConfig

func (y ConfigYAML) VerifyDynamoDBConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyDynamoDBConfig verifies .DB.DynamoDB.

func (ConfigYAML) VerifyFileDBConfig

func (y ConfigYAML) VerifyFileDBConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyFileDBConfig verifies .DB.FileDB.

func (ConfigYAML) VerifyHTTPConfig

func (y ConfigYAML) VerifyHTTPConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyHTTPConfig verifies .HTTP.

func (ConfigYAML) VerifyLogConfig

func (y ConfigYAML) VerifyLogConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyResponderConfig verifies .Log.

func (ConfigYAML) VerifyResponderConfig

func (y ConfigYAML) VerifyResponderConfig(cfg DyOCSPConfig) (DyOCSPConfig, []error)

VerifyResponderConfig verifies .Responder.

type DyOCSPConfig

type DyOCSPConfig struct {
	// From ConfigYAML
	Version                  string
	Strict                   bool
	Expiration               string
	LogLevel                 string
	LogFormat                string
	CA                       string
	Certificate              string
	Key                      string
	Issuer                   string
	Interval                 int
	Delay                    int
	DynamoDBRegion           string
	DynamoDBTableName        string
	DynamoDBCAGsi            string
	DynamoDBEndpoint         string
	DynamoDBRetryMaxAttempts int
	DynamoDBTimeout          int
	FileDBFile               string
	Port                     string
	Domain                   string
	ReadTimeout              int
	WriteTimeout             int
	ReadHeaderTimeout        int
	MaxHeaderBytes           int
	MaxRequestBytes          int
	CacheControlMaxAge       int
	// From this struct
	ZerologLevel  zerolog.Level
	ZerologFormat LogFormat
	DBType        CADBType
}

The DyOCSPConfig struct contains configuration members for creating instances of DyOCSP. Please refer to the documentation for detailed information about each configuration.

type InvalidParameterError

type InvalidParameterError struct {
	// contains filtered or unexported fields
}

InvalidParameterError is used when configuration paramemter is invalid.

func (InvalidParameterError) Error

func (e InvalidParameterError) Error() string

type LogFormat

type LogFormat int

Supported log format.

const (
	// JSON format.
	JSONFormat LogFormat = iota
	// Pretty format (human readable).
	PrettyFormat
)

type MissingParameterError

type MissingParameterError struct {
	Param string
}

MissingParameterError is used when configuration paramemter is missing.

func (MissingParameterError) Error

func (e MissingParameterError) Error() string

Jump to

Keyboard shortcuts

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