infrastructure

package
v0.0.0-...-8d2886a Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeLocalToken = "FAKE_LOCAL_TOKEN"
	FakeUserID     = 999
)

Variables

This section is empty.

Functions

func InitDB

func InitDB(ctx context.Context, dns string) *gorm.DB

func InitRedis

func InitRedis(config *Config) *redis.Client

Types

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(allowFakeAuth bool, secret []byte) *AuthService

func (*AuthService) GetUserIdFromContext

func (as *AuthService) GetUserIdFromContext(c *gin.Context) uint

type Config

type Config struct {
	// базовые параметры
	IsDebug            bool
	HttpPort           string
	ArtWarehouseURL    string
	OriginWarehouseURL string

	// подключения к внешним службам
	DbDSN         string
	RedisAddr     string
	RedisPassword string

	// auth
	JwtSecret      string
	AllowFakeAuth  bool
	ArtchitectHost string
	ArtchitectorID int

	// telegram
	BotToken                string
	ChatArtchitectChoice    int64
	ChatArtchitectorChoice  int64
	ArtchitectChoiceEnabled bool
}

func InitEnv

func InitEnv() *Config

Jump to

Keyboard shortcuts

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