config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package config provides configuration for the screener-api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AppSecret is the app secret
	AppSecret string `yaml:"app-secret"`
	// AppID is the app id
	AppID string `yaml:"app-id"`
	// TRMKey is the api key for trmlabs
	TRMKey string `yaml:"trm-key"`
	// Rules of [caller_type]->risk_type
	Rulesets map[string]RulesetConfig `yaml:"rulesets"`
	// BlacklistURL is the url to the blacklist file
	// this is appplied to all rules and cannot be overridden
	BlacklistURL string `yaml:"blacklist-url"`
	// CacheTime is the time to cache results for (in seconds)
	// can be overridden per rulesets
	CacheTime int `yaml:"cache-time"`
	// Port is the port to listen on
	Port int `yaml:"port"`
	// Database is the database configuration
	Database DatabaseConfig `yaml:"database"`
	// VolumeThresholds is the volume thresholds for each risk type
	VolumeThresholds []VolumeThreshold `yaml:"volumeThresholds"`
	// TODO: This HAS to be re-structured somehow
	// Whitelist is a list of addresses to whitelist
	Whitelist []string `yaml:"whitelist"`
}

Config is the configuration for the screener.

func (Config) GetCacheTime

func (c Config) GetCacheTime(rulset string) time.Duration

GetCacheTime gets how long to use the cache for a given ruleset.

type DatabaseConfig

type DatabaseConfig struct {
	Type string `yaml:"type"`
	DSN  string `yaml:"dsn"` // Data Source Name
}

DatabaseConfig represents the configuration for the database.

type RulesetConfig

type RulesetConfig struct {
	// Filename is the filename of the ruleset
	Filename string `json:"filename"`
	// CacheTime (in seconds)
	CacheTime *int `json:"cache-time"`
}

RulesetConfig is the config for each given ruleset.

type VolumeThreshold added in v0.0.14

type VolumeThreshold struct {
	Category   string  `yaml:"category"`
	TypeOfRisk string  `yaml:"typeOfRisk"`
	Incoming   float64 `yaml:"incoming"`
	Outgoing   float64 `yaml:"outgoing"`
}

VolumeThreshold defines thresholds for different risk categories and types.

Jump to

Keyboard shortcuts

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