config

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	Port int    `yaml:"port" envconfig:"API_PORT"`
	Host string `yaml:"host" envconfig:"API_HOST"`
}

type Configuration

type Configuration struct {
	Env       string         `yaml:"env"`
	API       ApiConfig      `yaml:"api"`
	Mail      MailConfig     `yaml:"mail"`
	Redis     RedisConfig    `yaml:"redis"`
	Postgres  PostgresConfig `yaml:"postgres"`
	Mailjet   MailjetConfig  `yaml:"mailjet"`
	GCP       GCPConfig      `yaml:"gcp"`
	Log       LogConfig      `yaml:"log"`
	JWTSecret string         `yaml:"jwt_secret" envconfig:"JWT_SECRET"`
}

Configuration provide package level configuration for vendtron by reading from config.yaml first then overwrite if any with env (Default read from .env)

func Build

func Build(yamlPath, envPrefix string) (*Configuration, error)

type GCPConfig

type GCPConfig struct {
	ApplicationCredentials string `yaml:"application_credentials" envconfig:"GOOGLE_APPLICATION_CRENDETIALS"`
	BucketName             string `yaml:"bucket" envconfig:"GOOGLE_GCS_BUCKET"`
}

type LogConfig

type LogConfig struct {
	Level  string `yaml:"level" envconfig:"LOG_LEVEL"`
	Format string `yaml:"format" envconfig:"LOG_FORMAT"`
}

type MailConfig

type MailConfig struct {
	Port         int    `yaml:"port" envconfig:"MAIL_PORT"`
	Host         string `yaml:"host" envconfig:"MAIL_HOST"`
	Sender       string `yaml:"sender" envconfig:"MAIL_SENDER"`
	Queue        string `yaml:"queue" envconfig:"MAIL_QUEUE"`
	AuthUser     string `yaml:"auth_user" envconfig:"MAIL_AUTH_USER"`
	AuthPassword string `yaml:"auth_password" envconfig:"MAIL_AUTH_PASSWORD"`
	WorkerSpace  string `yaml:"worker_space" envconfig:"MAIL_WORKER_SPACE"`
}

type MailjetConfig

type MailjetConfig struct {
	PublicKey  string `yaml:"public_key" envconfig:"MAILJET_PUBLIC_KEY"`
	PrivateKey string `yaml:"private_key" envconfig:"MAILJET_PRIVATE_KEY"`
}

type PostgresConfig

type PostgresConfig struct {
	Port     int    `yaml:"port" envconfig:"POSTGRES_PORT"`
	Host     string `yaml:"host" envconfig:"POSTGRES_HOST"`
	User     string `yaml:"user" envconfig:"POSTGRES_USER"`
	Password string `yaml:"password" envconfig:"POSTGRES_PASSWORD"`
	DBName   string `yaml:"dbname" envconfig:"POSTGRES_DBNAME"`
	SSLMode  string `yaml:"sslmode" envconfig:"POSTGRES_SSLMODE"`
}

type RedisConfig

type RedisConfig struct {
	Port     int    `yaml:"port" envconfig:"REDIS_PORT"`
	Host     string `yaml:"host" envconfig:"REDIS_HOST"`
	Password string `yaml:"password" envconfig:"REDIS_PASSWORD"`
	DB       int    `yaml:"db" envconfig:"REDIS_DB"`
}

Jump to

Keyboard shortcuts

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