config

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authn

type Authn struct {
	Enabled   bool      `mapstructure:"enabled"`   // Whether authentication is enabled
	Method    string    `mapstructure:"method"`    // The authentication method to be used
	Preshared Preshared `mapstructure:"preshared"` // Configuration for preshared key authentication
	Oidc      Oidc      `mapstructure:"oidc"`      // Configuration for OIDC authentication
}

Authn contains configuration for authentication.

type Cache added in v0.3.1

type Cache struct {
	NumberOfCounters int64  `mapstructure:"number_of_counters"` // Number of counters for the cache
	MaxCost          string `mapstructure:"max_cost"`           // Maximum cost for the cache
}

Cache contains configuration for caching.

type Config

type Config struct {
	AccountID   string                       `mapstructure:"account_id"`
	Server      `mapstructure:"server"`      // Server configuration for both HTTP and gRPC
	Log         `mapstructure:"logger"`      // Logging configuration
	Profiler    `mapstructure:"profiler"`    // Profiler configuration
	Authn       `mapstructure:"authn"`       // Authentication configuration
	Tracer      `mapstructure:"tracer"`      // Tracing configuration
	Meter       `mapstructure:"meter"`       // Metrics configuration
	Service     `mapstructure:"service"`     // Service configuration
	Database    `mapstructure:"database"`    // Database configuration
	Distributed `mapstructure:"distributed"` // Distributed configuration
}

Config is the main configuration structure containing various sections for different aspects of the application.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig - Creates default config.

func NewConfig

func NewConfig() (*Config, error)

NewConfig initializes and returns a new Config object by reading and unmarshalling the configuration file from the given path. It falls back to the DefaultConfig if the file is not found. If there's an error during the process, it returns the error.

func NewConfigWithFile added in v0.4.0

func NewConfigWithFile(dir string) (*Config, error)

NewConfigWithFile initializes and returns a new Config object by reading and unmarshalling the configuration file from the given path. It falls back to the DefaultConfig if the file is not found. If there's an error during the process, it returns the error.

type Data added in v0.5.0

type Data struct{}

Data is a placeholder struct for the data service configuration.

type Database

type Database struct {
	Engine string `mapstructure:"engine"` // Database engine type (e.g., "postgres" or "memory")
	URI    string `mapstructure:"uri"`    // Database connection URI
	Writer struct {
		URI string `mapstructure:"uri"`
	} `mapstructure:"writer"`
	Reader struct {
		URI string `mapstructure:"uri"`
	} `mapstructure:"reader"`
	AutoMigrate           bool              `mapstructure:"auto_migrate"`            // Whether to enable automatic migration
	MaxOpenConnections    int               `mapstructure:"max_open_connections"`    // Maximum number of open connections to the database
	MaxIdleConnections    int               `mapstructure:"max_idle_connections"`    // Maximum number of idle connections to the database
	MaxConnectionLifetime time.Duration     `mapstructure:"max_connection_lifetime"` // Maximum duration a connection can be reused
	MaxConnectionIdleTime time.Duration     `mapstructure:"max_connection_idle_time"`
	MaxDataPerWrite       int               `mapstructure:"max_data_per_write"`
	MaxRetries            int               `mapstructure:"max_retries"`
	WatchBufferSize       int               `mapstructure:"watch_buffer_size"`
	GarbageCollection     GarbageCollection `mapstructure:"garbage_collection"`
}

Database contains configuration for the database.

type Distributed added in v0.4.0

type Distributed struct {
	Enabled bool   `mapstructure:"enabled"`
	Address string `mapstructure:"address"`
	Port    string `mapstructure:"port"`
}

type GRPC

type GRPC struct {
	Port      string    `mapstructure:"port"` // Port for the gRPC server
	TLSConfig TLSConfig `mapstructure:"tls"`  // TLS configuration for the gRPC server
}

GRPC contains configuration for the gRPC server.

type GarbageCollection added in v0.5.0

type GarbageCollection struct {
	Enabled  bool          `mapstructure:"enabled"`
	Interval time.Duration `mapstructure:"interval"`
	Timeout  time.Duration `mapstructure:"timeout"`
	Window   time.Duration `mapstructure:"window"`
}

type HTTP

type HTTP struct {
	Enabled            bool      `mapstructure:"enabled"`              // Whether the HTTP server is enabled
	Port               string    `mapstructure:"port"`                 // Port for the HTTP server
	TLSConfig          TLSConfig `mapstructure:"tls"`                  // TLS configuration for the HTTP server
	CORSAllowedOrigins []string  `mapstructure:"cors_allowed_origins"` // List of allowed origins for CORS
	CORSAllowedHeaders []string  `mapstructure:"cors_allowed_headers"` // List of allowed headers for CORS
}

HTTP contains configuration for the HTTP server.

type Log

type Log struct {
	Level    string   `mapstructure:"level"`    // Logging level
	Output   string   `mapstructure:"output"`   // Logging output format, e.g., text, json
	Enabled  bool     `mapstructure:"enabled"`  // Whether logging collection is enabled
	Exporter string   `mapstructure:"exporter"` // Exporter for log data
	Endpoint string   `mapstructure:"endpoint"` // Endpoint for the log exporter
	Insecure bool     `mapstructure:"insecure"` // Connect to the collector using the HTTP scheme, instead of HTTPS.
	URLPath  string   `mapstructure:"path"`     // Path for the log exporter, if not defined /v1/logs will be used
	Headers  []string `mapstructure:"headers"`
	Protocol string   `mapstructure:"protocol"` // Protocol for the log exporter, e.g., http, grpc
}

Log contains configuration for logging.

type Meter added in v0.2.1

type Meter struct {
	Enabled  bool     `mapstructure:"enabled"`  // Whether metrics collection is enabled
	Exporter string   `mapstructure:"exporter"` // Exporter for metrics data
	Endpoint string   `mapstructure:"endpoint"` // Endpoint for the metrics exporter
	Insecure bool     `mapstructure:"insecure"` // Connect to the collector using the HTTP scheme, instead of HTTPS.
	URLPath  string   `mapstructure:"path"`     // Path for the metrics exporter, if not defined /v1/metrics will be used
	Headers  []string `mapstructure:"headers"`
	Interval int      `mapstructure:"interval"`
	Protocol string   `mapstructure:"protocol"` // Protocol for the metrics exporter, e.g., http, grpc
}

Meter contains configuration for metrics collection and reporting.

type Oidc added in v0.3.1

type Oidc struct {
	Issuer            string        `mapstructure:"issuer"`   // OIDC issuer URL
	Audience          string        `mapstructure:"audience"` // OIDC client ID
	RefreshInterval   time.Duration `mapstructure:"refresh_interval"`
	BackoffInterval   time.Duration `mapstructure:"backoff_interval"`
	BackoffFrequency  time.Duration `mapstructure:"backoff_frequency"`
	BackoffMaxRetries int           `mapstructure:"backoff_max_retries"`
	ValidMethods      []string      `mapstructure:"valid_methods"`
}

Oidc contains configuration for OIDC authentication.

type Permission added in v0.3.1

type Permission struct {
	BulkLimit        int   `mapstructure:"bulk_limit"`        // Limit for bulk operations
	ConcurrencyLimit int   `mapstructure:"concurrency_limit"` // Limit for concurrent operations
	Cache            Cache `mapstructure:"cache"`             // Cache configuration for the permission service
}

Permission contains configuration for the permission service.

type Preshared added in v0.3.1

type Preshared struct {
	Keys []string `mapstructure:"keys"` // List of preshared keys
}

Preshared contains configuration for preshared key authentication.

type Profiler added in v0.3.0

type Profiler struct {
	Enabled bool   `mapstructure:"enabled"` // Whether the profiler is enabled
	Port    string `mapstructure:"port"`    // Port for the profiler
}

Profiler contains configuration for the profiler.

type Schema added in v0.3.1

type Schema struct {
	Cache Cache `mapstructure:"cache"` // Cache configuration for the schema service
}

Schema contains configuration for the schema service.

type Server

type Server struct {
	HTTP         `mapstructure:"http"` // HTTP server configuration
	GRPC         `mapstructure:"grpc"` // gRPC server configuration
	NameOverride string                `mapstructure:"name_override"`
	RateLimit    int64                 `mapstructure:"rate_limit"` // Rate limit configuration
}

Server contains the configurations for both HTTP and gRPC servers.

type Service

type Service struct {
	CircuitBreaker bool       `mapstructure:"circuit_breaker"` // Whether to enable the circuit breaker pattern
	Watch          Watch      `mapstructure:"watch"`           // Watch service configuration
	Schema         Schema     `mapstructure:"schema"`          // Schema service configuration
	Permission     Permission `mapstructure:"permission"`      // Permission service configuration
	Data           Data       `mapstructure:"data"`            // Data service configuration
}

Service contains configuration for various service-level features.

type TLSConfig

type TLSConfig struct {
	Enabled  bool   `mapstructure:"enabled"` // Whether TLS is enabled
	CertPath string `mapstructure:"cert"`    // Path to the certificate file
	KeyPath  string `mapstructure:"key"`     // Path to the key file
}

TLSConfig contains configuration for TLS.

type Tracer

type Tracer struct {
	Enabled  bool     `mapstructure:"enabled"`  // Whether tracing collection is enabled
	Exporter string   `mapstructure:"exporter"` // Exporter for tracing data
	Endpoint string   `mapstructure:"endpoint"` // Endpoint for the tracing exporter
	Insecure bool     `mapstructure:"insecure"` // Connect to the collector using the HTTP scheme, instead of HTTPS.
	URLPath  string   `mapstructure:"path"`     // Path for the tracing exporter, if not defined /v1/trace will be used
	Headers  []string `mapstructure:"headers"`
	Protocol string   `mapstructure:"protocol"` // Protocol for the tracing exporter, e.g., http, grpc
}

Tracer contains configuration for distributed tracing.

type Watch added in v0.4.4

type Watch struct {
	Enabled bool `mapstructure:"enabled"`
}

Watch contains configuration for the watch service.

Jump to

Keyboard shortcuts

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