config

package
v0.0.0-...-91fc04f Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API = "/api"
)

Variables

This section is empty.

Functions

func MigrateDatabase

func MigrateDatabase(dsn string) error

func NewCorsConfig

func NewCorsConfig(cfg Config) cors.Config

func NewDatabaseConnection

func NewDatabaseConnection(dsn string) *gorm.DB

func NewFiberConfig

func NewFiberConfig() fiber.Config

func NewLoggerConfig

func NewLoggerConfig() logger.Config

func NewReportsConfig

func NewReportsConfig(db *gorm.DB, storage *s3.Storage) reports.Config

func NewReservationsConfig

func NewReservationsConfig(db *gorm.DB) reservations.Config

func NewS3Config

func NewS3Config(cfg Config) s3.Config

func NewSwaggerConfig

func NewSwaggerConfig(s *swag.Spec) swagger.Config

func NewTransactionsConfig

func NewTransactionsConfig(db *gorm.DB) transactions.Config

func NewUsersConfig

func NewUsersConfig(db *gorm.DB) users.Config

Types

type Config

type Config struct {
	Port string `env:"BACKEND_PORT"`
	Host string `env:"BACKEND_HOST"`
	Addr string

	CorsOrigins string `env:"BACKEND_CORS_ORIGINS"`

	Database struct {
		Host     string `env:"DB_HOST"`
		Port     string `env:"DB_PORT"`
		User     string `env:"DB_USER"`
		Pass     string `env:"DB_PASS"`
		Name     string `env:"DB_NAME"`
		TimeZone string `env:"DB_TIMEZONE" envDefault:"UTC"`
		SSLMode  string `env:"DB_SSL_MODE" envDefault:"disable"`
		Dsn      string
	}

	S3 struct {
		Region          string        `env:"S3_REGION"`
		Bucket          string        `env:"S3_BUCKET"`
		Endpoint        string        `env:"S3_ENDPOINT"`
		AccessKey       string        `env:"S3_ACCESS_KEY"`
		SecretAccessKey string        `env:"S3_SECRET_ACCESS_KEY"`
		MaxAttempts     int           `env:"S3_MAX_ATTEMPTS" envDefault:"3"`
		RequestTimeout  time.Duration `env:"S3_REQUEST_TIMEOUT" envDefault:"0"`
	}
}

func NewConfig

func NewConfig() (Config, error)

Jump to

Keyboard shortcuts

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