utils

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupUnknownSettings

func CleanupUnknownSettings(ctx context.Context, settingsMgr SettingsPruner)

func Contains

func Contains(slice []string, item string) bool

Contains checks if a string slice contains an item

func DerefString

func DerefString(p *string) string

func EnsureEncryptionKey

func EnsureEncryptionKey(ctx context.Context, cfg *config.Config, ensureKeyFunc func(context.Context) (string, error))

func ExtractCategoryMetadata

func ExtractCategoryMetadata(model any, categoryIDsInOrder []string) map[string]map[string]string

ExtractCategoryMetadata extracts category metadata from struct fields with catmeta tags Returns a map of category ID to category metadata in field order

func InitializeAutoLogin

func InitializeAutoLogin(ctx context.Context, cfg *config.Config)

func InitializeDefaultSettings

func InitializeDefaultSettings(ctx context.Context, cfg *config.Config, settingsMgr SettingsManager)

func InitializeNonAgentFeatures

func InitializeNonAgentFeatures(ctx context.Context, cfg *config.Config, createAdminFunc func(context.Context) error, autoLoginInitFunc func(context.Context) error, migrateOidcFunc func(context.Context) error, migrateDiscordFunc func(context.Context) error)

func LoadAgentToken

func LoadAgentToken(ctx context.Context, cfg *config.Config, getSettingFunc func(context.Context, string, string) string)

func MigrateGitOpsSyncIntervals

func MigrateGitOpsSyncIntervals(
	ctx context.Context,
	listFunc func(context.Context) ([]IntervalMigrationItem, error),
	updateFunc func(context.Context, string, int) error,
)

func MigrateSchedulerCronValues

func MigrateSchedulerCronValues(
	ctx context.Context,
	getSettingFunc func(context.Context, string, string) string,
	updateSettingFunc func(context.Context, string, string) error,
	reloadFunc func(context.Context) error,
)

func ParseKeywords

func ParseKeywords(keywordsStr string) []string

ParseKeywords parses a comma-separated keywords string into a slice Returns an empty slice if the input is empty or contains only whitespace

func ParseMetaTag

func ParseMetaTag(tag string) map[string]string

ParseMetaTag parses a struct tag meta value formatted as `k=v;other=val;...` Returns a map of key-value pairs extracted from the tag

func TestDockerConnection

func TestDockerConnection(ctx context.Context, testFunc func(context.Context) error)

func UpdateIfChanged

func UpdateIfChanged(target any, value any) bool

UpdateIfChanged updates the target value if it differs from the new value. It returns true if an update occurred. Supported types: *string, *bool, **string. For *string and *bool targets, if the value is a pointer of the same type, the update only happens if the value pointer is not nil.

Types

type IntervalMigrationItem

type IntervalMigrationItem struct {
	ID       string
	RawValue string
}

type SettingsManager

type SettingsManager interface {
	PersistEnvSettingsIfMissing(ctx context.Context) error
	SetBoolSetting(ctx context.Context, key string, value bool) error
	EnsureDefaultSettings(ctx context.Context) error
}

type SettingsPruner

type SettingsPruner interface {
	PruneUnknownSettings(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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