config

package
v0.0.0-...-e78ca02 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAddress        = ":3200"
	DefaultDatabaseDsn    = "postgresql://localhost:5432/gophkeeper"
	DefaultSecretKey      = "do-not-use-this-in-production!"
	DefaultTokenTTL       = time.Minute * 30
	DefaultTLSPath        = "cert/server-tls/"
	DefaultSecretKeysPath = "cert/secret-encryption/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	SaltKey  string        `env:"SALT_KEY"`
	TokenTTL time.Duration `env:"TOKEN_TTL"`
}

type ClientConfig

type ClientConfig struct {
	ServerURL   string `env:"SERVER" envDefault:":3200"`
	CertPath    string `env:"CERT" envDefault:"cert/server-tls"`
	StoragePath string `env:"STORAGE" envDefault:"/tmp/gophkeeper-storage"`
	Debug       bool   `env:"DEBUG" envDefault:"false"`
}

func NewClientConfigWithStorage

func NewClientConfigWithStorage() (*ClientConfig, error)

type Config

type Config struct {
	Server    ServerConfig
	Auth      AuthConfig
	Secrets   SecretsConfig
	DebugMode bool `env:"DEBUG"`
}

func NewConfig

func NewConfig() (*Config, error)

type SecretsConfig

type SecretsConfig struct {
	KeysDir string `env:"SECRET_KEYS_DIR"`
}

type ServerConfig

type ServerConfig struct {
	Address      string `env:"RUN_ADDRESS"`
	TLSCertsPath string `env:"TLS_PATH"`
	DatabaseDsn  string `env:"DATABASE_DSN"`
}

Jump to

Keyboard shortcuts

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