environment

package
v0.0.0-...-7d5b20a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Server    Server
	Database  Database
	SecretKey string `envconfig:"SECRET_KEY"`
}

func Load

func Load() (*Configuration, error)

func (Configuration) Validate

func (c Configuration) Validate() error

type Database

type Database struct {
	Sqlite   Sqlite
	Postgres Postgres
}

type Postgres

type Postgres struct {
	Host     string `envconfig:"POSTGRES_HOST" validate:"required"`
	Port     string `envconfig:"POSTGRES_PORT" validate:"required"`
	User     string `envconfig:"POSTGRES_USER" validate:"required"`
	Password string `envconfig:"POSTGRES_PASSWORD" validate:"required"`
	Database string `envconfig:"POSTGRES_DATABASE" validate:"required"`
	SSLMode  string `envconfig:"POSTGRES_SSL_MODE"`
}

func (Postgres) BuildConnectionString

func (p Postgres) BuildConnectionString() string

func (Postgres) IsValid

func (p Postgres) IsValid() bool

type Server

type Server struct {
	Port string `envconfig:"PORT" validate:"required"`
}

type Sqlite

type Sqlite struct {
	DatabaseName string `envconfig:"SQLITE_DATABASE" validate:"required"`
}

func (Sqlite) IsValid

func (s Sqlite) IsValid() bool

Jump to

Keyboard shortcuts

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