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:
Location | Details |
---|---|
/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 variables | Finally, 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.
Name | Environment Variable Key | Type | Description |
---|---|---|---|
Authentication | POSTGRES_AUTHENTICATION | Parent key for authentication information. | |
↳ username | ↳ .USERNAME | string | Username for Postgres session login. |
↳ password | ↳ .PASSWORD | string | Password for Postgres session login. |
Connection | POSTGRES_CONNECTION | Parent key for connection information. | |
↳ database | ↳ .DATABASE | string | Database name. |
↳ host | ↳ .HOST | string | Hostname or IP address. |
↳ maxConnectionAttempts | ↳ .MAXCONNECTIONATTEMPTS | int | Number of times to attempt a connection to the database using Binary Exponential Backoff. |
↳ timeout | ↳ .TIMEOUT | int | Connection timeout in seconds. |
↳ port | ↳ .PORT | uint16 | Host port. |
Pool | POSTGRES_POOL | Parent key for connection pool information. | |
↳ healthCheckPeriod | ↳ .HEALTHCHECKPERIOD | time.Duration | Seconds (min=5) between health checks for each connection in the pool. |
↳ maxConns | ↳ .MAXCONNS | int32 | Maximum connections (min=4) to retain in the connection pool. |
↳ minConns | ↳ .MINCONNS | int32 | Minimum 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
# Type aliases
No description provided by the author