configs

package
v0.0.0-...-dcf0478 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package configs implement configurations that the application needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name   string `env:"BOT_NAME,required"`
	Token  string `env:"BOT_APITOKEN,required"`
	Driver string `env:"BOT_DB_DRIVER,required"`
}

type Config

type Config struct {
	App      App
	Postgres Postgres
	MySQL    MySQL
	MongoDB  MongoDB
}

func New

func New(logger logger.Logger, mode models.Mode) (*Config, error)

New returns the config, if can't open .env file or parse environment variables it returns an error.

make sure to delete the .env file and pass production mode in production.

type MongoDB

type MongoDB struct {
	Protocol string `env:"BOT_MONGODB_PROTOCOL,required"`
	Username string `env:"BOT_MONGODB_USERNAME,required"`
	Password string `env:"BOT_MONGODB_PASSWORD,required"`
	Host     string `env:"BOT_MONGODB_HOST,required"`
	Port     string `env:"BOT_MONGODB_PORT,required"`
	DBName   string `env:"BOT_MONGODB_DBNAME,required"`
}

type MySQL

type MySQL struct {
	Username string `env:"BOT_MYSQL_USERNAME,required"`
	Password string `env:"BOT_MYSQL_PASSWORD,required"`
	Protocol string `env:"BOT_MYSQL_PROTOCOL,required"`
	Host     string `env:"BOT_MYSQL_HOST,required"`
	Port     string `env:"BOT_MYSQL_PORT,required"`
	DBName   string `env:"BOT_MYSQL_DBNAME,required"`
}

type Postgres

type Postgres struct {
	Host     string `env:"BOT_POSTGRES_HOST,required"`
	Port     string `env:"BOT_POSTGRES_PORT,required"`
	Username string `env:"BOT_POSTGRES_USERNAME,required"`
	Password string `env:"BOT_POSTGRES_PASSWORD,required"`
	DBName   string `env:"BOT_POSTGRES_DBNAME,required"`
	SSL      string `env:"BOT_POSTGRES_SSL_MODE,required"`
}

Jump to

Keyboard shortcuts

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