Documentation ¶
Overview ¶
Package app provides structures and functions to configure and run application.
Index ¶
- func NewJWT(cfg *Config) (jwt.Builder, jwt.Parser, error)
- func NewServer(cfg *Config, logger log.Logger, user usecase.User, token usecase.Token, ...) *http.Server
- func Run(cfg *Config, logger log.Logger) error
- type ATConfig
- type BcryptConfig
- type Config
- type Environment
- type HTTPConfig
- type KeyConfig
- type PostgresConfig
- type RTConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJWT ¶
NewJWT reads private and public keys, creates JWT builder and JWT parser. It returns error if keys read failed or configuration is incorrect.
Types ¶
type BcryptConfig ¶
type BcryptConfig struct {
Cost int `env:"BCRYPT_COST" default:"4"`
}
type Config ¶
type Config struct { Name string `env:"APP_NAME" default:"auth"` Env Environment `env:"APP_ENV" default:"development"` Key KeyConfig HTTP HTTPConfig Postgres PostgresConfig AT ATConfig RT RTConfig Bcrypt BcryptConfig }
Config represents app configuration structure.
type Environment ¶
type Environment string
const ( EnvDev Environment = "development" EnvProd Environment = "production" )
type HTTPConfig ¶
type PostgresConfig ¶
type PostgresConfig struct {
URI string `env:"POSTGRES_URI"`
}
Click to show internal directories.
Click to hide internal directories.