config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpirationTimeInHours = 24 // ExpirationTimeInHours is the expiration time for the JWT token
	SQLMaxOpenConns       = 10 // SQLMaxOpenConns is the max number of connections in the open connection pool
	SQLMaxIdleConns       = 1  // SQLMaxIdleConns is the max number of connections in the idle connection pool

	OauthStateLength = 16 // OauthStateLength is the length of the state for oauth

	RedisDefaultExpireTime = 6 * time.Hour // RedisDefaultExpireTime is the default expiration time for keys

	CacheExpireTime = 10 * time.Second // CacheExpireTime is the expiration time for the cache

	GCThresholdPercent = 0.7 // GCThresholdPercent is the threshold for garbage collection

	GCLimit = 1024 * 1024 * 1024 // GCLimit is the limit for garbage collection

	RistrettoMaxCost     = 3 * MB // RistrettoMaxCost is the maximum cost
	RistrettoBufferItems = 32     // RistrettoBufferItems is the number of items per get buffer
	RistrettoNumCounters = 1e4    // RistrettoNumCounters is the number of counters

	MB = 1024 * 1024 // MB is the number of bytes in a megabyte

	MaxPasswordLength = 72 // MaxPasswordLength is the max password length
	MinPasswordLength = 8  // MinPasswordLength is the min password length

	SentryFlushTimeout = 2 * time.Second // SentryFlushTimeout is the timeout for flushing sentry
)

Variables

This section is empty.

Functions

func GetCallbackURL

func GetCallbackURL() string

func GetConfigPath

func GetConfigPath() string

func IsDevelopment

func IsDevelopment() bool

func IsProduction

func IsProduction() bool

Types

type AuthConfig added in v1.2.2

type AuthConfig struct {
	JWTSecret     string
	JWTHeaderLen  int
	JWTExpiration int
	Discord       oauth.DiscordConfig
	Github        oauth.GithubConfig
	Bcryptcost    int
}

AuthConfig holds the configuration for the authentication.

type Config

type Config struct {
	Server   ServerConfig
	Database DatabaseConfig
	Redis    RedisConfig
	Log      LogConfig
	Auth     AuthConfig
	Sentry   SentryConfig
}

Config holds the configuration for the application.

func LoadConfig added in v1.2.2

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

LoadConfig loads the configuration from a file.

type DatabaseConfig added in v1.2.2

type DatabaseConfig struct {
	DSN string
}

DatabaseConfig holds the configuration for the database.

type JwtInstanceSingleton added in v1.2.2

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

func GetJwtInstance

func GetJwtInstance() *JwtInstanceSingleton

func (*JwtInstanceSingleton) GetJwt added in v1.2.2

func (j *JwtInstanceSingleton) GetJwt() myJwt.Instance

func (*JwtInstanceSingleton) SetJwt added in v1.2.2

func (j *JwtInstanceSingleton) SetJwt(instance myJwt.Instance)

type KeyManager added in v1.2.2

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

func GetKeyManagerInstance added in v1.2.2

func GetKeyManagerInstance() *KeyManager

func (*KeyManager) GetPrivateKey added in v1.2.2

func (k *KeyManager) GetPrivateKey() ed25519.PrivateKey

func (*KeyManager) GetPublicKey added in v1.2.2

func (k *KeyManager) GetPublicKey() ed25519.PublicKey

func (*KeyManager) ParseEd25519Key added in v1.2.2

func (k *KeyManager) ParseEd25519Key() error

type LogConfig added in v1.2.2

type LogConfig struct {
	Level string
}

LogConfig holds the configuration for the logger.

func (*LogConfig) GetSlogLevel added in v1.2.2

func (logConfig *LogConfig) GetSlogLevel() slog.Level

type PasswordConfigStruct

type PasswordConfigStruct struct {
	Iterations uint32 // Iterations to use for Argon2ID
	Memory     uint32 // Memory to use for Argon2ID
	Threads    uint8  // Threads to use for Argon2ID
	KeyLen     uint32 // KeyLen to use for Argon2ID
	SaltLen    uint32 // SaltLen to use for Argon2ID
}

PasswordConfigStruct is the struct for the password config.

type RedisConfig added in v1.2.2

type RedisConfig struct {
	Addr         string
	Password     string
	MinIdleConns int
	PoolSize     int
	PoolTimeout  int
}

RedisConfig holds the configuration for the redis client.

type SentryConfig added in v1.2.2

type SentryConfig struct {
	Debug              bool
	Environment        string
	Release            string
	TracesSampleRate   float64
	ProfilesSampleRate float64
	DSN                string
}

SentryConfig holds the configuration for the sentry client.

type ServerConfig added in v1.2.2

type ServerConfig struct {
	Port        string
	AppVersion  string
	JaegerURL   string
	Host        string
	FrontendURL string
	LogLevel    string
}

ServerConfig holds the configuration for the server.

Jump to

Keyboard shortcuts

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