config

package
v0.0.0-...-819fda8 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Meta
	Environment    string
	AuthBasePath   string
	StocksBasePath string
	Timeout        time.Duration

	// Auth
	CookieStoreSecret  string
	CookieMaxAge       int
	GoogleClientID     string
	GoogleClientSecret string
	GoogleCallbackUrl  string
	HashCost           int

	DatabaseHost     string
	DatabaseUser     string
	DatabasePassword string
	DatabasePort     int
	DatabaseName     string

	FinnHubApiKey string
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig() *Config

func (*Config) GetCookieStore

func (c *Config) GetCookieStore() *sessions.CookieStore

func (*Config) GetDatalayer

func (c *Config) GetDatalayer() (datalayer.StockStore, error)

GetDatalayer connects to the database and returns a valid StockStore or a connection error. The connection pool is cached in the config object.

func (*Config) GetStockFetcher

func (c *Config) GetStockFetcher() stockfetcher.StockFetcher

GetStockFetcher generates the API client for fetching stock prices. The client is cached in the config object.

func (*Config) IsProd

func (c *Config) IsProd() bool

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures that all required env vars are set. Does not validate that the values are valid, such as whether the DB password will work.

Jump to

Keyboard shortcuts

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