package
0.0.0-20240814010835-9fc48a241e25
Repository: https://github.com/surahman/ftex.git
Documentation: pkg.go.dev

# README

Postgres

Configuration loading is designed for containerization in mind. The container engine and orchestrator can mount volumes (secret or regular) as well as set the environment variables as outlined below.

You may set configurations through both files and environment variables. Please note that environment variables will override the settings in the configuration files. The configuration files are all expected to be in YAML format.


Table of contents


File Location(s)

The configuration loader will search for the configurations in the following order:

LocationDetails
/etc/FTeX.conf/The etc directory is the canonical location for configurations.
$HOME/.FTeX/Configurations can be located in the user's home directory.
./configs/The config folder in the root directory where the application is located.
Environment variablesFinally, the configurations will be loaded from environment variables and override configuration files

Configuration File

The expected file name is PostgresConfig.yaml. All the configuration items below are required unless specified otherwise.

NameEnvironment Variable KeyTypeDescription
AuthenticationPOSTGRES_AUTHENTICATIONParent key for authentication information.
↳ username.USERNAMEstringUsername for Postgres session login.
↳ password.PASSWORDstringPassword for Postgres session login.
ConnectionPOSTGRES_CONNECTIONParent key for connection information.
↳ database.DATABASEstringDatabase name.
↳ host.HOSTstringHostname or IP address.
↳ maxConnectionAttempts.MAXCONNECTIONATTEMPTSintNumber of times to attempt a connection to the database using Binary Exponential Backoff.
↳ timeout.TIMEOUTintConnection timeout in seconds.
↳ port.PORTuint16Host port.
PoolPOSTGRES_POOLParent key for connection pool information.
↳ healthCheckPeriod.HEALTHCHECKPERIODtime.DurationSeconds (min=5) between health checks for each connection in the pool.
↳ maxConns.MAXCONNSint32Maximum connections (min=4) to retain in the connection pool.
↳ minConns.MINCONNSint32Minimum connections (min=4) to retain in the connection pool.

Example Configuration File

authentication:
  username: postgres
  password: postgres
connection:
  database: ft-ex-db
  host: 127.0.0.1
  maxConnectionAttempts: 5
  port: 6432
  timeout: 5
pool:
  healthCheckPeriod: 30s
  maxConns: 8
  minConns: 4

Example Environment Variables

export POSTGRES_AUTHENTICATION.USERNAME=admin
export POSTGRES_AUTHENTICATION.PASSWORD=root

Design Documentation

The technology selection case study and table schema design documentation can be found here.

# Functions

No description provided by the author
NewError is a base error message with no special code.
NewMockQuerier creates a new mock instance.
NewPostgres will create a new Postgres configuration by loading it.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

ErrCreateFiat is returned if a Fiat account could not be opened.
ErrLoginUser is returned if user credentials are not found.
ErrNotFound is returned as a generic not found error.
ErrNotFoundUser is returned if a user account is not found.
ErrorRegisterUser is returned if user registration fails.
ErrTransactCrypto is returned if a Crypto transaction fails.
ErrTransactCryptoDetails is returned if a Crypto transaction succeeds, but transaction retrieval fails.
ErrTransactFiat is returned if a Fiat transaction fails.
ErrUnhealthy is returned if the database cannot be pinged.

# Structs

No description provided by the author
No description provided by the author
Error is the base error type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MockQuerier is a mock of Querier interface.
MockQuerierMockRecorder is the mock recorder for MockQuerier.
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
Postgres is the interface through which the queries will be executed on the database.
No description provided by the author

# Type aliases

No description provided by the author