cfg

package
v0.0.0-...-64661d1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 4 Imported by: 9

Documentation

Overview

Package cfg is for reading config from environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	Host           string // The host to connect to [DB_HOST].
	User           string // The user to sign in as [DB_USER].
	Password       string // The user's password [DB_PASSWD].
	Name           string // The name of the database to connect to [DB_NAME].
	SSLMode        string // Whether or not to use SSL [DB_SSLMODE].
	ConnectTimeout int    // Maximum wait for connection, in seconds [DB_CONN_TIMEOUT].
	MaxIdle        int    // Maximum idle db connections [DB_MAX_IDLE_CONNS].
	MaxOpen        int    // Connection pool size [DB_MAX_OPEN_CONNS].
}

func PostgresEnv

func PostgresEnv() (Postgres, error)

PostgresEnv returns a Postgres with configuration from the environment variables. Returns an error for missing config or errors parsing int values.

func (*Postgres) Connection

func (p *Postgres) Connection() string

Jump to

Keyboard shortcuts

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