configs

package
v0.0.0-...-ebfe39f Latest Latest
Warning

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

Go to latest
Published: May 11, 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
	MySQL    MySQL
	MySQLite MySQLite
}

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. TODO: разобраться как работают прод и дев режимы make sure to delete the .env file and pass production mode in production.

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 MySQLite

type MySQLite struct {
	Path   string `env:"BOT_MYSQLite_PATH,required"`
	DBName string `env:"BOT_MYSQLite_DBNAME,required"`
}

Jump to

Keyboard shortcuts

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