config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Issuer          string        `env-default:"chatyx" yaml:"issuer"`
	SignKey         string        `env:"SIGN_KEY"       env-required:"true"      yaml:"sign_key"`
	AccessTokenTTL  time.Duration `env-default:"15m"    yaml:"access_token_ttl"`
	RefreshTokenTTL time.Duration `env-default:"720h"   yaml:"refresh_token_ttl"`
}

type Config

type Config struct {
	Domain   string   `env-default:"localhost" yaml:"domain"`
	Debug    bool     `yaml:"debug"`
	Log      Log      `yaml:"log"`
	API      Server   `env-prefix:"API_"       yaml:"api"`
	Chat     Server   `env-prefix:"CHAT_"      yaml:"chat"`
	Cors     Cors     `yaml:"cors"`
	Auth     Auth     `yaml:"auth"`
	Postgres Postgres `env-prefix:"POSTGRES_"  yaml:"postgres"`
	Redis    Redis    `env-prefix:"REDIS_"     yaml:"redis"`
}

type Conn

type Conn struct {
	Host     string        `env:"HOST"        env-default:"localhost" yaml:"host"`
	Port     string        `env:"PORT"        env-required:"true"     yaml:"port"`
	Database string        `env:"DB"          env-required:"true"     yaml:"database"`
	User     string        `env:"USER"        env-required:"true"     yaml:"user"`
	Password string        `env:"PASSWORD"    yaml:"password"`
	Timeout  time.Duration `env-default:"15s" yaml:"timeout"`
}

type Cors

type Cors struct {
	AllowedOrigins []string      `env-default:"*" yaml:"allowed_origins"`
	MaxAge         time.Duration `yaml:"max_age"`
}

type Log

type Log struct {
	Level string `env-default:"debug" yaml:"level"`
}

type Postgres

type Postgres struct {
	Conn            `yaml:"conn"`
	MaxOpenConns    int           `yaml:"max_open_conns"`
	MinOpenConns    int           `yaml:"min_open_conns"`
	ConnMaxIdleTime time.Duration `yaml:"conn_max_idle_time"`
	ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime"`
}

type Redis

type Redis struct {
	Conn `yaml:"conn"`
}

type Server

type Server struct {
	Listen       string        `env:"LISTEN"      env-default:":8080"  yaml:"listen"`
	ReadTimeout  time.Duration `env-default:"15s" yaml:"read_timeout"`
	WriteTimeout time.Duration `env-default:"15s" yaml:"write_timeout"`
}

Jump to

Keyboard shortcuts

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