config

package
v0.0.0-...-60a76ff Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Pepper    string         `env:"PEPPER"`
	Env       string         `env:"ENV"`
	FromEmail string         `env:"EMAIL_FROM"`
	Port      int            `env:"PORT"`
	JWTSecret string         `env:"JWT_SECRET"`
	Mailgun   MailgunConfig  `json:"mailgun"`
	Postgres  PostgresConfig `json:"postgres"`
}

func GetConfig

func GetConfig() Config

type MailgunConfig

type MailgunConfig struct {
	APIKey    string `env:"MAILGUN_API_KEY"`
	PublicKey string `env:"MAILGUN_PUBLIC_KEY"`
	Domain    string `env:"MAILGUN_DOMAIN"`
}

func GetMailgunConfig

func GetMailgunConfig() MailgunConfig

type PostgresConfig

type PostgresConfig struct {
	Host     string `env:"POSTGRES_HOST"`
	Port     int    `env:"POSTGRES_PORT"`
	User     string `env:"POSTGRES_USER"`
	Password string `env:"POSTGRES_PASSWORD"`
	Database string `env:"POSTGRES_DB"`
}

PostgresConfig is the config for postgres

func GetPostgresConfig

func GetPostgresConfig() PostgresConfig

GetPostgresConfig returns the postgres config

func (*PostgresConfig) Config

func (c *PostgresConfig) Config() *gorm.Config

db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) Dialect returns the dialect for postgres

func (*PostgresConfig) GetConnectionInfo

func (c *PostgresConfig) GetConnectionInfo() gorm.Dialector

GetConnectionInfo returns the connection info for postgres

Jump to

Keyboard shortcuts

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