utils

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package utils provides utility functions for the Scroll paymaster service.

Package utils provides common flags for the Scroll paymaster service.

Package utils provides logging functionality for the Scroll paymaster service.

Package utils provides versioning information for the Scroll paymaster service.

Index

Constants

This section is empty.

Variables

View Source
var (
	// CommonFlags is used for app common flags in different modules
	CommonFlags = []cli.Flag{
		&ConfigFileFlag,

		&HTTPEnabledFlag,
		&HTTPListenAddrFlag,
		&HTTPPortFlag,

		&verbosityFlag,
		&logDebugFlag,

		&MetricsEnabled,
		&MetricsAddr,
		&MetricsPort,

		&DBFlag,
		&DBMigrateFlag,
		&DBRollBackFlag,
		&DBResetFlag,
	}
	// ConfigFileFlag load json type config file.
	ConfigFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "JSON configuration file.",
		Value: "./conf/config.json",
	}

	// HTTPEnabledFlag enable rpc server.
	HTTPEnabledFlag = cli.BoolFlag{
		Name:  "http",
		Usage: "Enable the HTTP-RPC server.",
		Value: false,
	}
	// HTTPListenAddrFlag set the http address.
	HTTPListenAddrFlag = cli.StringFlag{
		Name:  "http.addr",
		Usage: "HTTP-RPC server listening interface.",
		Value: "localhost",
	}
	// HTTPPortFlag set http.port.
	HTTPPortFlag = cli.IntFlag{
		Name:  "http.port",
		Usage: "HTTP-RPC server listening port.",
		Value: 8750,
	}

	// MetricsEnabled enable metrics collection and reporting
	MetricsEnabled = cli.BoolFlag{
		Name:     "metrics",
		Usage:    "Enable metrics collection and reporting.",
		Category: "METRICS",
		Value:    false,
	}
	// MetricsAddr is listening address of Metrics reporting server
	MetricsAddr = cli.StringFlag{
		Name:     "metrics.addr",
		Usage:    "Metrics reporting server listening address.",
		Category: "METRICS",
		Value:    "127.0.0.1",
	}
	// MetricsPort is listening port of Metrics reporting server
	MetricsPort = cli.IntFlag{
		Name:     "metrics.port",
		Usage:    "Metrics reporting server listening port.",
		Category: "METRICS",
		Value:    6060,
	}

	// DBFlag enable db operation.
	DBFlag = cli.BoolFlag{
		Name:  "db",
		Usage: "Enable db operation.",
		Value: false,
	}
	// DBMigrateFlag migrate db.
	DBMigrateFlag = cli.BoolFlag{
		Name:  "db.migrate",
		Usage: "Migrate the database to the latest version.",
		Value: false,
	}
	// DBRollBackFlag rollback db.
	DBRollBackFlag = cli.Int64Flag{
		Name:  "db.rollback",
		Usage: "Roll back the database to a previous <version>.",
		Value: 1000000,
	}
	// DBResetFlag reset db.
	DBResetFlag = cli.BoolFlag{
		Name:  "db.reset",
		Usage: "Clean and reset database.",
		Value: false,
	}
)
View Source
var Version = fmt.Sprintf("%s-%s", tag, commit)

Version denotes the version of paymaster.

Functions

func IsValidAPIKey added in v0.0.3

func IsValidAPIKey(apiKey string, allowedKeys []string) bool

IsValidAPIKey checks if the provided API key is valid against the list of allowed keys.

func LogSetup

func LogSetup(ctx *cli.Context)

LogSetup configures the logging system based on CLI context flags

Types

This section is empty.

Directories

Path Synopsis
Package database provides the database configuration for the Scroll paymaster service.
Package database provides the database configuration for the Scroll paymaster service.
Package observability registers the gin metric for the Scroll paymaster service.
Package observability registers the gin metric for the Scroll paymaster service.
ginmetrics
Package ginmetrics provides a simple bloom filter implementation for use in Gin middleware.
Package ginmetrics provides a simple bloom filter implementation for use in Gin middleware.

Jump to

Keyboard shortcuts

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