config

package
v0.0.0-...-d8ec886 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerifyEmailRoute string = "/api/v1/auth/verify/email/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HttpAddr  string
	SecretKey string

	AllVerifiedByDefault bool

	MongoUrl string
	RedisUrl string

	HealthcheckMessage string

	ClientOrigin string

	AccessPrivateKey   string
	AccessPublicKey    string
	AccessTokenExpired time.Duration
	AccessTokenMaxAge  int

	RefreshPrivateKey   string
	RefreshPublicKey    string
	RefreshTokenExpired time.Duration
	RefreshTokenMaxAge  int

	EmailFrom string
	SMTPPass  string
	SMTPUser  string
	SMTPHost  string
	SMTPPort  string
}

Config is a config

func NewTestConfig

func NewTestConfig() Config

func ReadEnv

func ReadEnv() Config

ReadEnv Read reads config from environment.

type ConfigV2

type ConfigV2 struct {
	MongoUrl string `mapstructure:"MONGODB_URL"`
	RedisUrl string `mapstructure:"REDIS_URL"`
	Port     string `mapstructure:"PORT"`

	AccessTokenPrivateKey  string        `mapstructure:"ACCESS_TOKEN_PRIVATE_KEY"`
	AccessTokenPublicKey   string        `mapstructure:"ACCESS_TOKEN_PUBLIC_KEY"`
	RefreshTokenPrivateKey string        `mapstructure:"REFRESH_TOKEN_PRIVATE_KEY"`
	RefreshTokenPublicKey  string        `mapstructure:"REFRESH_TOKEN_PUBLIC_KEY"`
	AccessTokenExpiresIn   time.Duration `mapstructure:"ACCESS_TOKEN_EXPIRED_IN"`
	RefreshTokenExpiresIn  time.Duration `mapstructure:"REFRESH_TOKEN_EXPIRED_IN"`
	AccessTokenMaxAge      int           `mapstructure:"ACCESS_TOKEN_MAXAGE"`
	RefreshTokenMaxAge     int           `mapstructure:"REFRESH_TOKEN_MAXAGE"`

	Origin string `mapstructure:"CLIENT_ORIGIN"`
}

func LoadConfigV2

func LoadConfigV2(path string) (config ConfigV2, err error)

Jump to

Keyboard shortcuts

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