wip7
This commit is contained in:
+59
-13
@@ -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
|
||||
*/
|
||||
@@ -14,18 +14,57 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
const VERSION = "1.1.3"
|
||||
// Version информация, заполняется при сборке через ldflags
|
||||
var (
|
||||
VERSION = "dev"
|
||||
COMMIT = "unknown"
|
||||
)
|
||||
|
||||
// Arguments описывает аргументы командной строки
|
||||
type Arguments struct {
|
||||
IniPath string
|
||||
TagsPath string
|
||||
RandomCount uint
|
||||
RepeatCount uint
|
||||
RepeatEverySec uint
|
||||
NeedJson bool
|
||||
NeedQuiet bool
|
||||
Verbose bool
|
||||
IniPath string
|
||||
TagsPath string
|
||||
RandomCount uint
|
||||
RepeatCount uint
|
||||
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 +73,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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user