server

package
v0.0.0-...-4cccb1b Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminGroup

type AdminGroup struct {
	AdminPasswd string `long:"passwd" env:"PASSWD" default:"admin_password" description:"admin user password"`
	AdminEmail  string `long:"email" env:"EMAIL" default:"admin@email.com" description:"admin user email"`
}

AdminGroup defines options group for admin user params

type AuthGroup

type AuthGroup struct {
	TTL struct {
		Auth    time.Duration `long:"auth" env:"AUTH" default:"2h" description:"auth JWT TTL"`
		Refresh time.Duration `long:"refresh" env:"REFRESH" default:"24h" description:"refresh JWT TTL"`
		Cookie  time.Duration `long:"cookie" env:"COOKIE" default:"200h" description:"refresh cookie TTL"`
	} `group:"ttl" namespace:"ttl" env-namespace:"TTL"`

	Secret string `` /* 136-byte string literal not displayed */
}

AuthGroup defines options group for auth params

type AuthTokenResponse

type AuthTokenResponse struct {
	AccessToken string `json:"accessToken"`
	Type        string `json:"type"`
}

type CacheGroup

type CacheGroup struct {
	TagCacheTTL                time.Duration `long:"tag_cache_ttl" env:"TAG_CACHE_TTL" default:"3600s" description:"Cache TTL for tags"`
	TranslationCacheTTL        time.Duration `long:"translation_cache_ttl" env:"TRANSLATION_CACHE_TTL" default:"3600s" description:"Cache TTL for translations"`
	TranslationsSearchCacheTTL time.Duration `` /* 143-byte string literal not displayed */
	LangCacheTTL               time.Duration `long:"lang_cache_ttl" env:"LANG_CACHE_TTL" default:"3600s" description:"Cache TTL for languages"`
}

CacheGroup defines options group for in memory cache

type HTTPServer

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

func InitServer

func InitServer(opts Opts) (*HTTPServer, error)

func (*HTTPServer) CreateLang

func (s *HTTPServer) CreateLang() gin.HandlerFunc

func (*HTTPServer) CreateTag

func (s *HTTPServer) CreateTag() gin.HandlerFunc

func (*HTTPServer) CreateTranslation

func (s *HTTPServer) CreateTranslation() gin.HandlerFunc

func (*HTTPServer) CreateUser

func (s *HTTPServer) CreateUser() gin.HandlerFunc

func (*HTTPServer) DeleteLangByID

func (s *HTTPServer) DeleteLangByID() gin.HandlerFunc

func (*HTTPServer) DeleteTagByID

func (s *HTTPServer) DeleteTagByID() gin.HandlerFunc

func (*HTTPServer) DeleteTranslationByID

func (s *HTTPServer) DeleteTranslationByID() gin.HandlerFunc

func (*HTTPServer) DeleteUser

func (s *HTTPServer) DeleteUser() gin.HandlerFunc

func (*HTTPServer) GetLangByID

func (s *HTTPServer) GetLangByID() gin.HandlerFunc

func (*HTTPServer) GetLangs

func (s *HTTPServer) GetLangs() gin.HandlerFunc

func (*HTTPServer) GetProfile

func (s *HTTPServer) GetProfile() gin.HandlerFunc

func (*HTTPServer) GetRandomTranslations

func (s *HTTPServer) GetRandomTranslations() gin.HandlerFunc

func (*HTTPServer) GetRoles

func (s *HTTPServer) GetRoles() gin.HandlerFunc

func (*HTTPServer) GetTagByID

func (s *HTTPServer) GetTagByID() gin.HandlerFunc

func (*HTTPServer) GetTags

func (s *HTTPServer) GetTags() gin.HandlerFunc

func (*HTTPServer) GetTranslationByID

func (s *HTTPServer) GetTranslationByID() gin.HandlerFunc

func (*HTTPServer) GetUserByID

func (s *HTTPServer) GetUserByID() gin.HandlerFunc

func (*HTTPServer) GetUsers

func (s *HTTPServer) GetUsers() gin.HandlerFunc

func (*HTTPServer) Refresh

func (s *HTTPServer) Refresh() gin.HandlerFunc

func (*HTTPServer) Run

func (s *HTTPServer) Run() error

func (*HTTPServer) SearchTranslations

func (s *HTTPServer) SearchTranslations() gin.HandlerFunc

func (*HTTPServer) ServeStatic

func (s *HTTPServer) ServeStatic() gin.HandlerFunc

func (*HTTPServer) SighIn

func (s *HTTPServer) SighIn() gin.HandlerFunc

func (*HTTPServer) UpdateLang

func (s *HTTPServer) UpdateLang() gin.HandlerFunc

func (*HTTPServer) UpdateProfile

func (s *HTTPServer) UpdateProfile() gin.HandlerFunc

func (*HTTPServer) UpdateTag

func (s *HTTPServer) UpdateTag() gin.HandlerFunc

func (*HTTPServer) UpdateTranslation

func (s *HTTPServer) UpdateTranslation() gin.HandlerFunc

func (*HTTPServer) UpdateUser

func (s *HTTPServer) UpdateUser() gin.HandlerFunc

type MongoGroup

type MongoGroup struct {
	Database string `long:"database" env:"DB" default:"webdict" description:"name of the mongo DB"`
	Host     string `long:"host" env:"HOST" default:"localhost" description:"mongo DB host"`
	Port     int    `long:"port" env:"PORT" default:"27017" description:"mongo DB port"`
	Username string `long:"username" env:"USERNAME" default:"root" description:"name of the mongo username"`
	Passwd   string `long:"password" env:"PASSWD" default:"example" description:"mongo password"`
}

MongoGroup defines options group for mongo connection

type Opts

type Opts struct {
	Auth  AuthGroup  `group:"auth" namespace:"auth" env-namespace:"AUTH"`
	Admin AdminGroup `group:"admin" namespace:"admin" env-namespace:"ADMIN"`
	Mongo MongoGroup `group:"mongo" namespace:"mongo" env-namespace:"MONGO"`
	Cache CacheGroup `group:"cache" namespace:"cache" env-namespace:"CACHE"`

	Port       int    `long:"port" env:"PORT" default:"4000" description:"port"`
	WebdictURL string `long:"url" env:"URL" description:"url to webdict"`
	Dbg        bool   `long:"dbg" env:"DEBUG" description:"debug mode"`
}

Opts flags and envs to run server

Jump to

Keyboard shortcuts

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