config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config contains the configuration for the application. This layer is responsible for loading the configuration from the environment variables and validating it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	Window int64  `env:"CHALLENGE_WINDOW" env-default:"8"`
	Domain string `env:"CHALLENGE_DOMAIN" env-required:"true"`
}

type Config

type Config struct {
	MongoDB      MongoDB
	Server       Server
	Idenfy       Idenfy
	TFChain      TFChain
	Verification Verification
	IPLimiter    IPLimiter
	IDLimiter    IDLimiter
	Challenge    Challenge
	Log          Log
}

func LoadConfigFromEnv

func LoadConfigFromEnv() (*Config, error)

func (Config) GetPublicConfig

func (c Config) GetPublicConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

validate config

type IDLimiter

type IDLimiter struct {
	MaxTokenRequests uint `env:"ID_LIMITER_MAX_TOKEN_REQUESTS" env-default:"4"`
	TokenExpiration  uint `env:"ID_LIMITER_TOKEN_EXPIRATION" env-default:"1440"`
}

type IPLimiter

type IPLimiter struct {
	MaxTokenRequests uint `env:"IP_LIMITER_MAX_TOKEN_REQUESTS" env-default:"4"`
	TokenExpiration  uint `env:"IP_LIMITER_TOKEN_EXPIRATION" env-default:"1440"`
}

type Idenfy

type Idenfy struct {
	APIKey          string   `env:"IDENFY_API_KEY" env-required:"true"`
	APISecret       string   `env:"IDENFY_API_SECRET" env-required:"true"`
	BaseURL         string   `env:"IDENFY_BASE_URL" env-default:"https://ivs.idenfy.com"`
	CallbackSignKey string   `env:"IDENFY_CALLBACK_SIGN_KEY" env-required:"true"`
	WhitelistedIPs  []string `env:"IDENFY_WHITELISTED_IPS" env-separator:","`
	DevMode         bool     `env:"IDENFY_DEV_MODE" env-default:"false"`
	CallbackUrl     string   `env:"IDENFY_CALLBACK_URL" env-required:"false"`
	Namespace       string   `env:"IDENFY_NAMESPACE" env-default:""`
}

func (*Idenfy) GetAPIKey

func (c *Idenfy) GetAPIKey() string

func (*Idenfy) GetAPISecret

func (c *Idenfy) GetAPISecret() string

func (*Idenfy) GetBaseURL

func (c *Idenfy) GetBaseURL() string

func (*Idenfy) GetCallbackSignKey

func (c *Idenfy) GetCallbackSignKey() string

func (*Idenfy) GetCallbackUrl

func (c *Idenfy) GetCallbackUrl() string

implement getter for Idenfy

func (*Idenfy) GetDevMode

func (c *Idenfy) GetDevMode() bool

func (*Idenfy) GetNamespace

func (c *Idenfy) GetNamespace() string

func (*Idenfy) GetWhitelistedIPs

func (c *Idenfy) GetWhitelistedIPs() []string

type Log

type Log struct {
	Debug bool `env:"DEBUG" env-default:"false"`
}

type MongoDB

type MongoDB struct {
	URI          string `env:"MONGO_URI" env-default:"mongodb://localhost:27017"`
	DatabaseName string `env:"DATABASE_NAME" env-default:"tf-kyc-db"`
}

type Server

type Server struct {
	Port string `env:"PORT" env-default:"8080"`
}

type TFChain

type TFChain struct {
	WsProviderURL []string `env:"TFCHAIN_WS_PROVIDER_URL" env-default:"wss://tfchain.grid.tf" env-separator:","`
}

func (*TFChain) GetWsProviderURL

func (c *TFChain) GetWsProviderURL() []string

implement getter for TFChain

type Verification

type Verification struct {
	SuspiciousVerificationOutcome string   `env:"VERIFICATION_SUSPICIOUS_VERIFICATION_OUTCOME" env-default:"APPROVED"`
	ExpiredDocumentOutcome        string   `env:"VERIFICATION_EXPIRED_DOCUMENT_OUTCOME" env-default:"REJECTED"`
	MinBalanceToVerifyAccount     uint64   `env:"VERIFICATION_MIN_BALANCE_TO_VERIFY_ACCOUNT" env-default:"10000000"`
	AlwaysVerifiedIDs             []string `env:"VERIFICATION_ALWAYS_VERIFIED_IDS" env-separator:","`
	AlwaysVerifiedIDsOnly         bool     `env:"VERIFICATION_ALWAYS_VERIFIED_IDS_ONLY" env-default:"false"`
}

Jump to

Keyboard shortcuts

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