config

package
v0.0.0-...-2ebd334 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validator = validator.New()

Functions

This section is empty.

Types

type Config

type Config struct {
	ServerConf *ServerConfig   `toml:"server"`
	PgConfig   *PostgresConfig `toml:"database"`
	S3         *S3             `toml:"s3"`
}

func ParseAndValidate

func ParseAndValidate(filename string) (Config, error)

type PostgresConfig

type PostgresConfig struct {
	Host     string `toml:"host" validate:"required,hostname_port"`
	UserName string `toml:"user_name" validate:"required"`
	DBName   string `toml:"db_name" validate:"required"`
	Password string `toml:"password" validate:"required"`
}

func (*PostgresConfig) DSN

func (cfg *PostgresConfig) DSN() string

type S3

type S3 struct {
	Host            string `toml:"host" validate:"required,hostname_port"`
	AccessKeyID     string `toml:"accessKeyID" validate:"required"`
	SecretAccessKey string `toml:"secretAccessKey" validate:"required"`
	Bucket          string `toml:"bucket" validate:"required"`
}

type ServerConfig

type ServerConfig struct {
	Addr string `toml:"addr" validate:"required,hostname_port"`
}

Jump to

Keyboard shortcuts

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