config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfricasTalkingConfig

type AfricasTalkingConfig struct {
	Username  string
	APIKey    string
	BaseURL   string
	SenderID  string // from AT_SENDER_ID (alphanumeric or shortcode)
	Shortcode string // from AT_SHORTCODE (numeric shortcode)
}

AfricasTalkingConfig holds all SMS/USSD-related configuration for Africa's Talking

func (*AfricasTalkingConfig) ResolveSenderID

func (c *AfricasTalkingConfig) ResolveSenderID() string

ResolveSenderID returns the sender ID to use for SMS. Priority: SenderID > Shortcode > "" (AT defaults to AFRICASTKNG).

type AuthConfig

type AuthConfig struct {
	JWTSecret           string
	JWTExpiration       time.Duration
	JWTRefreshWindow    time.Duration
	ChallengeExpiration time.Duration
	PINLockoutDuration  time.Duration // from PIN_LOCKOUT_SECONDS (default 900 = 15min)
}

type Config

type Config struct {
	Postgres PostgresConfig
	Redis    RedisConfig
	Server   ServerConfig
	Stellar  StellarConfig
	Payments PaymentsConfig
	Mobile   MobileConfig
	Auth     AuthConfig
}

Config holds all configuration for the application, composed of sub-configs.

func New

func New() (*Config, error)

New loads and returns a new Config struct populated from environment variables.

type FonbnkConfig

type FonbnkConfig struct {
	ClientID     string
	ClientSecret string
	BaseURL      string
}

FonbnkConfig holds all Fonbnk-related configuration

type MobileConfig

type MobileConfig struct {
	AfricasTalking AfricasTalkingConfig
}

MobileConfig holds all mobile-related configuration

type PaymentsConfig

type PaymentsConfig struct {
	YellowCard YellowCardConfig
	Fonbnk     FonbnkConfig
}

PaymentsConfig bundles all payment provider configurations

type PostgresConfig

type PostgresConfig struct {
	Host     string
	User     string
	Password string
	DBName   string
	Port     string
	SSLMode  string
	TimeZone string
}

PostgresConfig holds all database-related configuration.

func (*PostgresConfig) DSN

func (c *PostgresConfig) DSN() string

DSN returns the connection string for Postgres.

type RedisConfig

type RedisConfig struct {
	Host           string
	Port           string
	Password       string
	DBNumber       int
	IdempotencyTTL time.Duration
}

RedisConfig holds all Redis-related configuration.

func (*RedisConfig) Addr

func (c *RedisConfig) Addr() string

Addr returns the host:port address for Redis.

func (*RedisConfig) GetIdempotencyTTL

func (c *RedisConfig) GetIdempotencyTTL() time.Duration

GetIdempotencyTTL returns the configured TTL or default of 24 hours

type ServerConfig

type ServerConfig struct {
	ServerEnvironment string
	ServerHost        string
	CoreServerPort    string
	CreditServerPort  string
}

ServerConfig holds all server-related configuration.

func (*ServerConfig) CoreAddr

func (c *ServerConfig) CoreAddr() string

CoreAddr returns the host:port address for the core server to listen on.

func (*ServerConfig) CreditAddr

func (c *ServerConfig) CreditAddr() string

CreditAddr returns the host:port address for the credit server to listen on.

type StellarConfig

type StellarConfig struct {
	RpcURL                  string
	AdminPublicKey          string
	AdminSecretKey          string
	TreasurySecretKey       string
	ServerSecretKey         string
	NetworkPassphrase       string
	EnableMultiSig          bool
	MultiSigLowThreshold    uint32
	MultiSigMediumThreshold uint32
	MultiSigHighThreshold   uint32
	USDCIssuer              string
	ContractID              string
}

StellarConfig holds all stellar-related configuration.

func (*StellarConfig) NewRpcClient

func (c *StellarConfig) NewRpcClient() *rpcclient.Client

NewRpcClient creates a new instance of Stellar RPC Client to connect with Stellar's RPC Server

type YellowCardConfig

type YellowCardConfig struct {
	PublicKey     string
	SecretKey     string
	BaseURL       string
	WebhookSecret string
	BusinessID    string // Registered business ID with YellowCard
	BusinessName  string // Registered business name with YellowCard
}

YellowCardConfig holds all YellowCard-related configuration

Jump to

Keyboard shortcuts

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