config

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 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 {
	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 Database

type Database struct {
	Engine                    string                    `mapstructure:"engine"`                  // Database engine type (e.g., "postgres" or "memory")
	URI                       string                    `mapstructure:"uri"`                     // Database connection URI
	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"`
	DatabaseGarbageCollection DatabaseGarbageCollection `mapstructure:"garbage_collection"`
}

Database contains configuration for the database.

type DatabaseGarbageCollection added in v0.3.8

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

type Distributed added in v0.4.0

type Distributed struct {
	Enabled bool     `mapstructure:"enabled"`
	Nodes   []string `mapstructure:"nodes"`
}

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 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
}

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
}

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
	ClientID string `mapstructure:"client_id"` // OIDC client ID
}

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 Relationship added in v0.3.1

type Relationship struct{}

Relationship is a placeholder struct for the relationship service configuration.

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
	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
	Relationship   Relationship `mapstructure:"relationship"`    // Relationship 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
}

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