infra

package
v0.0.0-...-f83d065 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDB

func LoadDB(dbconf DBConf) (*gorm.DB, error)

LoadDB load DB instance

Types

type Auth0Conf

type Auth0Conf struct {
	Domain       string
	ClientID     string
	ClientSecret string
	CallbackURL  string
	UserID       string
}

Auth0Conf .

type Authenticator

type Authenticator struct {
	*oidc.Provider
	oauth2.Config
}

Authenticator is used to authenticate our users.

func InitAuthenticator

func InitAuthenticator(authConf Auth0Conf) (*Authenticator, error)

InitAuthenticator instantiates the *Authenticator.

func (*Authenticator) VerifyIDToken

func (a *Authenticator) VerifyIDToken(ctx context.Context, token *oauth2.Token) (*oidc.IDToken, error)

VerifyIDToken verifies that an *oauth2.Token is a valid *oidc.IDToken.

type Conf

type Conf struct {
	HTTP  HTTPConf
	DB    DBConf
	Auth0 Auth0Conf

	Timezone string
	Mode     string
	Instance string
}

Conf configuration

func LoadConf

func LoadConf(path string) (*Conf, error)

LoadConf loads conf from environment variables or dotenv

func (Conf) IsDev

func (c Conf) IsDev() bool

IsDev .

func (Conf) IsProduction

func (c Conf) IsProduction() bool

IsProduction .

func (Conf) IsTesting

func (c Conf) IsTesting() bool

IsTesting .

type DBConf

type DBConf struct {
	Provider string
	Host     string
	Name     string
	User     string
	Pass     string
}

DBConf .

type HTTPConf

type HTTPConf struct {
	Port  string
	Token string
}

HTTPConf .

Jump to

Keyboard shortcuts

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