config

package
v0.0.0-...-bd23c5e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DisableVolumeDirs Kavita has a bug where it rescans series on each scan loop when they have subfolders
	// until this has been resolved, we will not be adding the volume dir
	// See https://github.com/Kareadita/Kavita/issues/3557
	DisableVolumeDirs = boolFeature("DISABLE_VOLUME_DIRS")

	// DisableOneShotInFileName removed the (OneShot) in the filename
	DisableOneShotInFileName = boolFeature("DISABLE_ONE_SHOT_IN_FILE_NAME")

	// SkipTagsOnFailure will skip tag writing if preferences fail to load
	SkipTagsOnFailure = boolFeature("SKIP_TAGS_ON_FAILURE")
)
View Source
var (
	Dir = orDefault(os.Getenv("CONFIG_DIR"), ".")

	ErrInvalidSyncID = errors.New("invalid sync id")
)

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	Type      CacheType `json:"type"`
	RedisAddr string    `json:"redis,omitempty"`
}

type CacheType

type CacheType string
const (
	MEMORY CacheType = "MEMORY"
	REDIS  CacheType = "REDIS"
)

type Config

type Config struct {
	Version int    `json:"version"`
	SyncId  int    `json:"sync_id"`
	RootDir string `json:"root_dir"`
	BaseUrl string `json:"base_url"`
	Secret  string `json:"secret"`

	HasUpdatedDB bool `json:"has_updated_db"`

	Logging    Logging     `json:"logging"`
	Downloader Downloader  `json:"downloader"`
	Cache      CacheConfig `json:"cache"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load() (*Config, error)

func (*Config) Save

func (current *Config) Save(cfg *Config, backUp ...bool) error

func (*Config) Update

func (current *Config) Update(config Config, syncID int) error

type Downloader

type Downloader struct {
	MaxConcurrentTorrents       int  `json:"max_torrents" validate:"required,number,min=1,max=10"`
	MaxConcurrentMangadexImages int  `json:"max_mangadex_images" validate:"required,number,min=1,max=5"`
	DisableIpv6                 bool `json:"disable_ipv6"`
}

type LogHandler

type LogHandler string
const (
	LogHandlerText LogHandler = "TEXT"
	LogHandlerJSON LogHandler = "JSON"
)

type Logging

type Logging struct {
	Level   zerolog.Level `json:"level"`
	Source  bool          `json:"source"`
	Handler LogHandler    `json:"handler" validate:"uppercase"`
}

Jump to

Keyboard shortcuts

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