config

package
v0.0.0-...-d867389 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvConfig

type EnvConfig struct {
	Grpc    `yaml:"grpc"`
	Storage `yaml:"storage"`
	EnvFile `yaml:"env_file"`
}

EnvConfig is a struct that holds all the configuration for the server

func (*EnvConfig) GrpcHostEnvName

func (cfg *EnvConfig) GrpcHostEnvName() string

GrpcHostEnvName returns the GRPC host environment name

func (*EnvConfig) GrpcPortEnvName

func (cfg *EnvConfig) GrpcPortEnvName() string

GrpcPortEnvName returns the GRPC port environment name

func (*EnvConfig) PGDatabaseEnvName

func (cfg *EnvConfig) PGDatabaseEnvName() string

PGDatabaseEnvName returns the Postgres database environment name

func (*EnvConfig) PGHostEnvName

func (cfg *EnvConfig) PGHostEnvName() string

PGHostEnvName returns the Postgres host environment name

func (*EnvConfig) PGPasswordEnvName

func (cfg *EnvConfig) PGPasswordEnvName() string

PGPasswordEnvName returns the Postgres password environment name

func (*EnvConfig) PGPortEnvName

func (cfg *EnvConfig) PGPortEnvName() string

PGPortEnvName returns the Postgres port environment name

func (*EnvConfig) PGSSLModeEnvName

func (cfg *EnvConfig) PGSSLModeEnvName() string

PGSSLModeEnvName returns the Postgres sslmode environment name

func (*EnvConfig) PGUserEnvName

func (cfg *EnvConfig) PGUserEnvName() string

PGUserEnvName returns the Postgres user environment name

type EnvConfiger

type EnvConfiger interface {
	GrpcEnvConfiger
	PgEnvConfiger
}

EnvConfiger interface for config environment

func NewEnvConfig

func NewEnvConfig() (EnvConfiger, error)

NewEnvConfig returns a new EnvConfig struct

type EnvFile

type EnvFile struct {
	Path string `yaml:"path" env-default:"./.env"`
}

EnvFile is a struct that holds all the configuration for the env file

type Grpc

type Grpc struct {
	Host string `yaml:"host" env-default:"GRPC_HOST"`
	Port string `yaml:"port" env-default:"GRPC_PORT"`
}

Grpc is a struct that holds all the configuration for the GRPC server

type GrpcConfiger

type GrpcConfiger interface {
	Address() string
}

GrpcConfiger interface for grpc config

func NewGrpcConfig

func NewGrpcConfig(env EnvConfiger) (GrpcConfiger, error)

NewGrpcConfig returns a new instance of GrpcConfiger

type GrpcEnvConfiger

type GrpcEnvConfiger interface {
	GrpcHostEnvName() string
	GrpcPortEnvName() string
}

GrpcEnvConfiger interface for config GRPC environment

type PgConfiger

type PgConfiger interface {
	DSN() string
}

PgConfiger interface for config Postgres

func NewPGConfig

func NewPGConfig(env EnvConfiger) (PgConfiger, error)

NewPGConfig is a function that returns a new instance of the PgConfiger interface

type PgEnvConfiger

type PgEnvConfiger interface {
	PGHostEnvName() string
	PGPortEnvName() string
	PGUserEnvName() string
	PGPasswordEnvName() string
	PGDatabaseEnvName() string
	PGSSLModeEnvName() string
}

PgEnvConfiger interface for config Postgres environment

type Postgres

type Postgres struct {
	Host     string `yaml:"host" env-default:"PG_HOST"`
	Port     string `yaml:"port" env-default:"PG_PORT"`
	User     string `yaml:"user" env-default:"PG_USER"`
	Password string `yaml:"pass" env-default:"PG_PASSWORD"`
	Database string `yaml:"database" env-default:"PG_DATABASE"`
	SslMode  string `yaml:"sslmode" env-default:"PG_SSLMODE"`
}

Postgres is a struct that holds all the configuration for the postgres

type Storage

type Storage struct {
	Postgres `yaml:"postgres"`
}

Storage is a struct that holds all the configuration for the storage

Jump to

Keyboard shortcuts

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