This commit is contained in:
2026-07-13 12:28:59 +08:00
parent 6c3de4b2ef
commit d5167ef3c0
45 changed files with 5967 additions and 189 deletions
+47 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Антон Аксенов
* Copyright (c) 2025-2026, Антон Аксенов
* This file is part of iptvc project
* MIT License: https://git.axenov.dev/IPTV/iptvc/src/branch/master/LICENSE
*/
@@ -26,6 +26,42 @@ type Arguments struct {
NeedJson bool
NeedQuiet bool
Verbose bool
ServerPort uint
ServerHost string
ConfigPath string
NeedCheck bool
Files []string
Urls []string
Codes []string
// app
Debug bool
LogLevel string
// check.playlists
PlTimeout int
PlAllCooldown int
PlOneCooldown int
PlMaxRoutines int
PlPerRoutine int
PlUserAgent []string
// check.channels
ChTimeout int
ChByteRange int
ChCooldown int
ChMaxRoutines int
ChPerRoutine int
ChUserAgent []string
// cache
CacheEnabled bool
CacheHost string
CachePort uint
CacheUsername string
CachePassword string
CacheDb uint
CacheTtl uint
}
var (
@@ -34,11 +70,18 @@ var (
Config *config.Config
)
// Init инициализирует конфигурацию и подключение к keydb
// Init загружает конфигурацию и инициализирует логгер.
// CLI-override применяются через applyAppOverrides(), applyCacheOverrides()
// и applyCheckOverrides() в обработчиках команд после Init().
func Init() {
Config = config.Init()
Config = config.Init(Args.ConfigPath)
logger.Init(Args.NeedQuiet)
if Config.Cache.IsEnabled {
}
// InitCache инициализирует подключение к KeyDB/Redis, если кеш включён.
// Вызывайте после применения всех cache-override.
func InitCache() {
if Config.Cache.Enabled {
Cache = cache.Init(&Config.Cache)
}
}