config

package
v0.11.0-rc10 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0, MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlagCfg is the flag for cfg.
	FlagCfg = "cfg"
	// FlagComponents is the flag for components.
	FlagComponents = "components"
	// FlagSaveConfigPath is the flag to save the final configuration file
	FlagSaveConfigPath = "save-config-path"
	// FlagDisableDefaultConfigVars is the flag to force all variables to be set on config-files
	FlagDisableDefaultConfigVars = "disable-default-config-vars"
	// FlagAllowDeprecatedFields is the flag to allow deprecated fields
	FlagAllowDeprecatedFields = "allow-deprecated-fields"

	EnvVarPrefix       = "CDK"
	ConfigType         = "toml"
	SaveConfigFileName = "aggkit_config.toml"

	DefaultCreationFilePermissions = os.FileMode(0600)
)
View Source
const DefaultMandatoryVars = `` /* 1117-byte string literal not displayed */

This values doesnt have a default value because depend on the environment / deployment

View Source
const DefaultValues = `` /* 13503-byte string literal not displayed */

DefaultValues is the default configuration

View Source
const DefaultVars = `` /* 373-byte string literal not displayed */

This doesnt below to config, but are the vars used to avoid repetition in config-files

Variables

View Source
var (
	ErrCycleVars                 = fmt.Errorf("cycle vars")
	ErrMissingVars               = fmt.Errorf("missing vars")
	ErrUnsupportedConfigFileType = fmt.Errorf("unsupported config file type")
)

Functions

func RemoveQuotesForVars

func RemoveQuotesForVars(data string) string

func RemoveTypeMarks

func RemoveTypeMarks(data string) string

func SaveConfigToFile

func SaveConfigToFile(cfg *Config, saveConfigPath string) error

func SaveDataToFile

func SaveDataToFile(fullPath, reason string, data []byte) error

Types

type Config

type Config struct {
	// Configure Log level for all the services, allow also to store the logs in a file
	Log log.Config

	// Common Config that affects all the services
	Common ethermanconfig.CommonConfig

	// L1NetworkConfig represents the L1 network config and contains RPC URL alongside L1 contract addresses.
	L1NetworkConfig ethermanconfig.L1NetworkConfig

	// L2NetworkConfig holds configuration specific to the L2 network.
	L2NetworkConfig ethermanconfig.L2NetworkConfig

	// PublicREST contains the configuration for the public-facing REST API server.
	PublicREST common.RESTConfig

	// AdminREST contains the configuration for the admin REST API server.
	AdminREST common.RESTConfig

	// RPC is the config for the RPC server
	RPC jRPC.Config

	// Configuration of the reorg detector service to be used for the L1
	ReorgDetectorL1 reorgdetector.Config

	// Configuration of the reorg detector service to be used for the L2
	ReorgDetectorL2 reorgdetector.Config

	// Configuration of the aggOracle service
	AggOracle aggoracle.Config

	// Configuration of the L1 Info Treee Sync service
	L1InfoTreeSync l1infotreesync.Config

	// BridgeL1Sync is the configuration for the synchronizer of the bridge of the L1
	BridgeL1Sync bridgesync.Config
	// ClaimL1Sync is the configuration for the synchronizer of the claims of the L1
	ClaimL1Sync claimsync.ConfigStandalone

	// BridgeL2Sync is the configuration for the synchronizer of the bridge of the L2
	BridgeL2Sync bridgesync.Config
	// ClaimL2Sync is the configuration for the synchronizer of the claims of the L2
	ClaimL2Sync claimsync.ConfigStandalone

	// L2GERSync is the config for the synchronizer in charge of syncing the GER injected on L2.
	// Needed for the bridge service (RPC)
	L2GERSync l2gersync.Config

	// AggSender is the configuration of the agg sender service
	AggSender aggsendercfg.Config

	// Prometheus is the configuration of the prometheus service
	Prometheus prometheus.Config

	// AggchainProofGen is the configuration of the Aggchain Proof Generation Tool
	AggchainProofGen prover.Config

	// Profiling is the configuration of the profiling service
	Profiling pprof.Config

	// Validator is the configuration of the aggsender validator service
	Validator validator.Config

	// AutoClaim is the configuration of the auto claim service.
	AutoClaim autoclaimcfg.Config

	// L1Multidownloader is the configuration of the multidownloader service for L1
	L1Multidownloader multidownloader.Config

	// L2Multidownloader is the configuration of the multidownloader service for L2
	L2Multidownloader multidownloader.Config
}

Config represents the configuration of the entire Aggkit Node The file is TOML format

func Load

func Load(ctx *cli.Context) (*Config, error)

Load loads the configuration

func LoadFile

func LoadFile(files []FileData, saveConfigPath string,
	setDefaultVars bool, allowDeprecatedFields bool) (*Config, error)

Load loads the configuration

func LoadFileFromString

func LoadFileFromString(configFileData string, configType string) (*Config, error)

Load loads the configuration

func (*Config) Checksum

func (cfg *Config) Checksum() (string, error)

Checksum returns a hex-encoded FNV-1a checksum of the fully-resolved configuration (public and private alike), marshaled to TOML the same way it's written to disk by SaveConfigToFile. It's not cryptographically secure — it's not meant to be, just a fast, dependency-free fingerprint — so it must never be used to detect tampering, only incidental change.

It's reported as InternalConfigChecksum on the bridge service's public config endpoint, where it lets an operator with access to the full config detect any change to it, even one that isn't exposed on that endpoint. To detect changes limited to the fields actually exposed there, see bridgeservice/types.PublicConfigResponse.PublicChecksum instead.

type ConfigRender

type ConfigRender struct {
	// 0: default, 1: specific
	FilesData []FileData
	// Function to resolve environment variables typically: Os.LookupEnv
	LookupEnvFunc     func(key string) (string, bool)
	EnvinormentPrefix string
}

func NewConfigRender

func NewConfigRender(filesData []FileData, envinormentPrefix string) *ConfigRender

func (*ConfigRender) GetUnresolvedVars

func (c *ConfigRender) GetUnresolvedVars(tpl *fasttemplate.Template,
	data map[string]interface{}, useEnv bool) []string

GetUnresolvedVars returns the vars in template that are no on data In this case we don't use environment variables

func (*ConfigRender) GetVars

func (c *ConfigRender) GetVars(configData string) []string

GetVars returns the vars in template

func (*ConfigRender) Merge

func (c *ConfigRender) Merge() (string, error)

func (*ConfigRender) ReadTemplateAdnDefinedValues

func (c *ConfigRender) ReadTemplateAdnDefinedValues(data string) (*fasttemplate.Template,
	map[string]interface{}, error)

The variables in data must be in format template: A={{B}} no A="{{B}}"

func (*ConfigRender) Render

func (c *ConfigRender) Render() (string, error)

- Merge all files - Resolve all variables inside

func (*ConfigRender) ResolveCycle

func (c *ConfigRender) ResolveCycle(partialResolvedConfigData string) (string, error)

ResolveCycle resolve the cycle vars: It iterate to configData, each step must reduce the number of 'vars' if not means that there are cycle vars

func (*ConfigRender) ResolveVars

func (c *ConfigRender) ResolveVars(fullConfigData string) (string, error)

type DeprecatedField

type DeprecatedField struct {
	// If the field name ends with a dot means that match a section
	FieldNamePattern string
	Reason           string
	// WarnOnly fields log a warning instead of failing the config load. Use it
	// for renames whose old section is still emitted by external tooling.
	WarnOnly bool
}

type DeprecatedFieldsError

type DeprecatedFieldsError struct {
	// key is the rule and the value is the field's name that matches the rule
	Fields map[DeprecatedField][]string
}

func NewErrDeprecatedFields

func NewErrDeprecatedFields() *DeprecatedFieldsError

func (*DeprecatedFieldsError) AddDeprecatedField

func (e *DeprecatedFieldsError) AddDeprecatedField(fieldName string, rule DeprecatedField)

func (*DeprecatedFieldsError) Error

func (e *DeprecatedFieldsError) Error() string

type FileData

type FileData struct {
	Name    string
	Content string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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