config

package
v0.0.0-...-c56863d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides the functionality of managing configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port     string `env:"PORT,default=6666"`
	Database Database
	Google   Google
	Hashid   Hashid
}

Config holds configuration for the project.

func NewConfig

func NewConfig(env string) (*Config, error)

NewConfig creates an instance of Config. It needs the path of the env file to be used.

type Database

type Database struct {
	Host         string `env:"DATABASE_HOST,default=localhost"`
	Port         string `env:"DATABASE_PORT,default=5432"`
	Username     string `env:"DATABASE_USERNAME,required"`
	Password     string `env:"DATABASE_PASSWORD,required"`
	Name         string `env:"DATABASE_NAME,required"`
	SSLMode      string `env:"DATABASE_SSL_MODE,default=disable"`
	MaxOpenConns int    `env:"DATABASE_MAX_OPEN_CONNS,default=5"`
	MaxIdleConns int    `env:"DATABASE_MAX_IDLE_CONNS,default=1"`
}

Database holds configuration for database.

type Google

type Google struct {
	Audience string `env:"GOOGLE_AUDIENCE,required"`
}

Google holds configuration related to Google.

type Hashid

type Hashid struct {
	Salt      string `env:"HASHID_SALT,required"`
	MinLength uint   `env:"HASHID_MIN_LENGTH,required"`
}

Hashid holds configuration related to Hashid.

Jump to

Keyboard shortcuts

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