Refactor core configuration and UUID handling

- Changed UUIDLength type from byte to int in core/config/consts.go
- Introduced MetaDir constant in core/config/consts.go
- Added corestate package with initial state management and UUID handling
- Implemented GetNodeUUID and SetNodeUUID functions for UUID file management
- Created RunManager and RunFileManager for runtime directory management
- Updated GeneralServer to use new configuration structure
- Removed deprecated init package and replaced with main entry point
- Added color utility functions for logging
- Enhanced UUID generation functions in utils package
- Updated update logic to handle new configuration structure
- Added routines for cleaning temporary runtime directories
- Introduced response formatting for API responses
This commit is contained in:
alex
2025-07-09 01:21:34 +03:00
parent 8d01314ded
commit 9919f77c90
31 changed files with 1186 additions and 275 deletions

View File

@@ -13,16 +13,16 @@ import (
type HandlerV1InitStruct struct {
Ver string
Log slog.Logger
Config *config.ConfigConf
Config *config.Conf
AllowedCmd *regexp.Regexp
ListAllowedCmd *regexp.Regexp
}
// HandlerV1 implements the ServerV1UtilsContract and serves as the main handler for API requests.
type HandlerV1 struct {
log slog.Logger
log *slog.Logger
cfg *config.ConfigConf
cfg *config.Conf
// allowedCmd and listAllowedCmd are regular expressions used to validate command names.
allowedCmd *regexp.Regexp
@@ -36,7 +36,7 @@ type HandlerV1 struct {
// because there is no validation of parameters in this function.
func InitV1Server(o *HandlerV1InitStruct) *HandlerV1 {
return &HandlerV1{
log: o.Log,
log: &o.Log,
cfg: o.Config,
allowedCmd: o.AllowedCmd,
listAllowedCmd: o.ListAllowedCmd,