config

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// A unique Id is necessary so that we cannot use a jwt on another server instance
	Id           AccountUUID `yaml:"id" example:"4ce589e2-b483-467b-8b59-758b339801d0"`
	Name         string      `yaml:"name"`
	SecretAPIKey string      `yaml:"secretAPIKey"`
}

type AccountUUID

type AccountUUID = uuid.UUID

type AuthConfig

type AuthConfig struct {
	Enable  bool   `yaml:"enable"`
	Method  string `yaml:"method" example:"FILE"`
	Methods struct {
		File struct {
			Filename string `yaml:"filename"`
		}
		HTTP struct {
			Url                string `yaml:"url"`
			ProxyUrl           string `yaml:"proxy"`
			AuthToken          string `yaml:"authToken"`
			Timeout            int    `yaml:"timeout"`
			CacheDurationInSec int    `yaml:"cacheDurationInSec"`
		}
	}
}

type Config

type Config struct {
	Storage struct {
		Type         string     `yaml:"type" example:"JSONFile"`
		LoggerConfig zap.Config `yaml:"logger"`
		LogVerbosity int        `yaml:"logVerbosity"`
		JSONFile     struct {
			DataDirectory string `yaml:"dataDirectory"`
		} `yaml:"jsonfile"`
		InMemory struct {
			MaxRecordsByStream uint64 `yaml:"maxRecordsByStream"`
			MaxSize            string `yaml:"maxSize"`
		} `yaml:"inmemory"`
		MySQL struct {
			// https://github.com/Go-SQL-Driver/MySQL/?tab=readme-ov-file#dsn-data-source-name
			DataSourceName    string `yaml:"dsn" example:"user:password@tcp(localhost:3306)/ministream?tls=skip-verify"`
			ConnMaxLifetime   uint   `yaml:"connMaxLifetime" example:"0"`
			MaxIdleConns      uint   `yaml:"maxIdleConns" example:"3"`
			MaxOpenConns      uint   `yaml:"maxOpenConns" example:"3"`
			SchemaName        string `yaml:"schemaName" example:"ministream"`
			CatalogTableName  string `yaml:"catalogTableName" example:"streams"`
			StreamTablePrefix string `yaml:"streamTablePrefix" example:"stream_"`
		} `yaml:"mysql"`
	}
	DataDirectory string     `yaml:"dataDirectory"`
	LoggerConfig  zap.Config `yaml:"logger"`
	Account       Account    `yaml:"account"`
	Streams       struct {
		BulkFlushFrequency        int  `yaml:"bulkFlushFrequency"`
		BulkMaxSize               int  `yaml:"bulkMaxSize"`
		ChannelBufferSize         int  `yaml:"channelBufferSize"`
		MaxIteratorsPerStream     int  `yaml:"maxAllowedIteratorsPerStream"`
		MaxMessagePerGetOperation uint `yaml:"maxMessagePerGetOperation"`
		LogVerbosity              int  `yaml:"logVerbosity"`
		MaxAllowedStreams         uint `yaml:"maxAllowedStreams" example:"25"`
	}
	Auth AuthConfig `yaml:"auth"`
	RBAC struct {
		Enable   bool   `yaml:"enable"`
		Filename string `yaml:"filename"`
	}
	AuditLog struct {
		Enable                 bool `yaml:"enable"`
		EnableLogAccessGranted bool `yaml:"enableLogAccessGranted"`
	}
	WebServer WebServerConfig `yaml:"webserver"`
}

func LoadConfig

func LoadConfig(filename string) (*Config, error)

type JWTConfig added in v1.5.0

type JWTConfig struct {
	Enable                  bool      `yaml:"enable"`
	SecretKey               string    `yaml:"secretKey"`
	TokenExpireInMinutes    int       `yaml:"tokenExpireInMinutes"`
	ISS                     string    `yaml:"iss"`
	Sub                     string    `yaml:"sub"`
	Aud                     string    `yaml:"aud"`
	AccountId               string    `yaml:"accountId"`
	RevokeEmittedBeforeDate time.Time `yaml:"revokeEmittedBeforeDate"`
}

type WebServerConfig added in v1.5.0

type WebServerConfig struct {
	HTTP struct {
		Enable  bool   `yaml:"enable"`
		Address string `yaml:"address"`
	}
	HTTPS struct {
		Enable   bool   `yaml:"enable"`
		Address  string `yaml:"address"`
		CertFile string `yaml:"certFile"`
		KeyFile  string `yaml:"keyFile"`
	}
	Logs struct {
		Enable bool `yaml:"enable"`
	}
	Cors struct {
		Enable       bool   `yaml:"enable"`
		AllowOrigins string `yaml:"allowOrigins"`
		AllowHeaders string `yaml:"allowHeaders"`
	}
	RateLimiter struct {
		Enable      bool `yaml:"enable"`
		RouteStream struct {
			MaxRequests       int `yaml:"maxRequests"`
			DurationInSeconds int `yaml:"durationInSeconds"`
		} `yaml:"routeStream"`
		RouteJob struct {
			MaxRequests       int `yaml:"maxRequests"`
			DurationInSeconds int `yaml:"durationInSeconds"`
		} `yaml:"routeJob"`
		RouteAccount struct {
			MaxRequests       int `yaml:"maxRequests"`
			DurationInSeconds int `yaml:"durationInSeconds"`
		} `yaml:"routeAccount"`
	} `yaml:"rateLimiter"`
	JWT     JWTConfig `yaml:"jwt"`
	Monitor struct {
		Enable bool `yaml:"enable"`
	}
	Metrics struct {
		Enable bool `yaml:"enable"`
	}
	Swagger struct {
		Enable bool `yaml:"enable"`
	}
}

Jump to

Keyboard shortcuts

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