loader

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package loader provides rules loading via parser-kit (multi-source fallback/merge).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLoadOptions

func BuildLoadOptions(cfg *cmd.Config, appMode string) *parserkit.LoadOptions

BuildLoadOptions builds parser-kit LoadOptions from warden config and app mode.

func BuildSources

func BuildSources(rulesFile, dataDir, configURL, auth, appMode string) []parserkit.Source

BuildSources builds parser-kit sources for the given mode (priority order). When dataDir is non-empty, all *.json files in that directory are added as file sources (sorted by name).

Types

type RulesLoader

type RulesLoader struct {
	// contains filtered or unexported fields
}

RulesLoader wraps parser-kit DataLoader and exposes FromFile/Load by (rulesFile, configURL, auth).

func NewRulesLoader

func NewRulesLoader(cfg *cmd.Config, appMode string) (*RulesLoader, error)

NewRulesLoader creates a RulesLoader using cfg and appMode.

func (*RulesLoader) FromFile

func (r *RulesLoader) FromFile(ctx context.Context, path string) ([]define.AllowListUser, error)

FromFile loads rules from a local file.

func (*RulesLoader) Load

func (r *RulesLoader) Load(ctx context.Context, rulesFile, dataDir, configURL, auth string) ([]define.AllowListUser, error)

Load loads rules from sources built from (rulesFile, dataDir, configURL, auth) and r.appMode. When remote decrypt is enabled, fetches remote with RSA decryption then merges with file sources.

Jump to

Keyboard shortcuts

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