container

package
v0.0.0-...-22d23f5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package container contains source code for initializing all dependencies of out application. A bit more for each file included in this pkg.

File config.go Config contains structs that will be filled during application startup. At the current moment, config get all the variables from environment variables. List of environment variable for the local development can be specified in .env file. Also, environment variables can be in OS environment variables, then they will also appear in the Config struct.

File container.go Container initialize all the application dependencies and stores them in defined structures. The Container contains some default structures for storing dependencies inside, but you can define your own.

File dependencies.go Contains definition of each application dependency. All the functions use the Container for setup own dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeName

func ExchangeName(exchangeName string, env Env, branch string) string

ExchangeName returns names with postfix for stage branch deployments.

Types

type Amqp

type Amqp struct {
	AmqpHost     string `env:"AMQP_HOST" envDefault:"localhost"`
	AmqpVhost    string `env:"AMQP_VHOST" envDefault:"/"`
	AmqpPort     string `env:"AMQP_PORT" envDefault:"5672"`
	AmqpUser     string `env:"AMQP_USER" envDefault:"guest"`
	AmqpPassword string `env:"AMQP_PASSWORD" envDefault:"guest"`
}

type ApplicationServices

type ApplicationServices struct {
}

type Apps

type Apps struct {
}

type Broker

type Broker struct {
}

type Clients

type Clients struct {
}

type Config

type Config struct {
	Environment Env    `env:"ENVIRONMENT" envDefault:"dev"`
	Branch      string `env:"BRANCH"`
	HTTPPort    string `env:"HTTP_PORT" envDefault:"4000"`

	DB   DB
	Amqp Amqp
}

func NewConfig

func NewConfig() Config

type Container

type Container struct {
	Config Config

	Apps        *Apps
	Clients     *Clients
	Storages    *Storages
	Services    *Services
	AppServices *ApplicationServices
	Databus     *Broker
}

func NewContainer

func NewContainer() *Container

func (*Container) Run

func (c *Container) Run() error

type DB

type DB struct {
	Schema               string        `env:"DATABASE_SCHEMA" envDefault:"public"`
	Database             string        `env:"PGDATABASE" envDefault:"postgres"`
	Host                 string        `env:"PGHOST" envDefault:"localhost"`
	Port                 string        `env:"PGPORT" envDefault:"5432"`
	User                 string        `env:"PGUSER" evnDefault:"postgres"`
	Password             string        `env:"PGPASSWORD" envDefault:"postgres"`
	MaxOpenedConnections int           `env:"DATABASE_MAX_OPENED_CONNECTIONS" envDefault:"10"`
	MaxIdleTimeout       time.Duration `env:"DATABASE_MAX_IDLE_TIMEOUT" envDefault:"5m"`
}

type Env

type Env string
var (
	Development Env = "dev"
	Stage       Env = "stage"
	Production  Env = "prod"
)

type Services

type Services struct {
}

type Storages

type Storages struct {
}

Jump to

Keyboard shortcuts

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