config

package
v0.0.0-...-8cb3723 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnection

func GetConnection() *pg.DB

GetConnection returns our pg database connection usage: db := config.GetConnection() defer db.Close()

func GetPostgresSuperUserConnection

func GetPostgresSuperUserConnection() *pg.DB

GetPostgresSuperUserConnection gets the corresponding db connection for our superuser

Types

type Configuration

type Configuration struct {
	Server *Server `yaml:"server"`
}

Configuration holds data necessery for configuring application

func Load

func Load(env string) *Configuration

Load returns Configuration struct

type JWT

type JWT struct {
	Realm            string `default:"jwtrealm"`
	Secret           string `default:""`
	Duration         int    `default:"15"`
	RefreshDuration  int    `default:"10"`
	MaxRefresh       int    `default:"10"`
	SigningAlgorithm string `default:"HS256"`
}

JWT holds data necessary for JWT configuration

func LoadJWT

func LoadJWT(env string) *JWT

LoadJWT returns our JWT with env variables and relevant defaults

type MagicConfig

type MagicConfig struct {
	Key    string `env:"MAGIC_API_KEY"`
	Secret string `env:"MAGIC_API_SECRET"`
}

MagicConfig persists the config for our Magic services

func GetMagicConfig

func GetMagicConfig() *MagicConfig

GetMagicConfig returns a MagicConfig pointer with the correct Magic.link Config values

type MailConfig

type MailConfig struct {
	Name  string `env:"DEFAULT_NAME"`
	Email string `env:"DEFAULT_EMAIL"`
}

MailConfig persists the config for our PostgreSQL database connection

func GetMailConfig

func GetMailConfig() *MailConfig

GetMailConfig returns a MailConfig pointer with the correct Mail Config values

type PostgresConfig

type PostgresConfig struct {
	URL      string `env:"DATABASE_URL"` // DATABASE_URL will be used in preference if it exists
	Host     string `env:"POSTGRES_HOST" envDefault:"localhost"`
	Port     string `env:"POSTGRES_PORT" envDefault:"5432"`
	User     string `env:"POSTGRES_USER"`
	Password string `env:"POSTGRES_PASSWORD"`
	Database string `env:"POSTGRES_DB"`
}

PostgresConfig persists the config for our PostgreSQL database connection

func GetPostgresConfig

func GetPostgresConfig() *PostgresConfig

GetPostgresConfig returns a PostgresConfig pointer with the correct Postgres Config values

type PostgresSuperUser

type PostgresSuperUser struct {
	Host     string `env:"POSTGRES_HOST" envDefault:"localhost"`
	Port     string `env:"POSTGRES_PORT" envDefault:"5432"`
	User     string `env:"POSTGRES_SUPERUSER" envDefault:"postgres"`
	Password string `env:"POSTGRES_SUPERUSER_PASSWORD" envDefault:""`
	Database string `env:"POSTGRES_SUPERUSER_DB" envDefault:"postgres"`
}

PostgresSuperUser persists the config for our PostgreSQL superuser

type Server

type Server struct {
	Mode string `yaml:"mode"`
}

Server holds data necessary for server configuration

type SiteConfig

type SiteConfig struct {
	ExternalURL string `env:"EXTERNAL_URL"  envDefault:"http://localhost:8080"`
}

SiteConfig persists global configs needed for our application

func GetSiteConfig

func GetSiteConfig() *SiteConfig

GetSiteConfig returns a SiteConfig pointer with the correct Site Config values

type TwilioConfig

type TwilioConfig struct {
	Account    string `env:"TWILIO_ACCOUNT"`
	Token      string `env:"TWILIO_TOKEN"`
	VerifyName string `env:"TWILIO_VERIFY_NAME"`
	Verify     string `env:"TWILIO_VERIFY"`
}

TwilioConfig persists the config for our Twilio services

func GetTwilioConfig

func GetTwilioConfig() *TwilioConfig

GetTwilioConfig returns a TwilioConfig pointer with the correct Mail Config values

Jump to

Keyboard shortcuts

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