Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CtxKeyLogger = ctxKey{"awesomemy.logger"} CtxKeyConfig = ctxKey{"awesomemy.config"} CtxKeyAuthUser = ctxKey{"awesomemy.auth.user"} )
Functions ¶
func MustContextValue ¶
MustContextValue retrieves a context value of type T with the given key. If the assertion fails, it panics.
Types ¶
type AuthenticationConfig ¶
type AuthenticationConfig struct { Session struct { Prefix string `yaml:"prefix"` Name string `yaml:"name"` Persist bool `yaml:"persist"` SameSite string `yaml:"same_site"` Secure bool `yaml:"secure"` Lifetime Duration `yaml:"lifetime"` } `yaml:"session"` OAuth2 AuthenticationOAuth2Config `yaml:"oauth2"` }
type AuthenticationOAuth2Config ¶
type AuthenticationOAuth2Config struct { GitHub struct { ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` } `yaml:"github"` }
func (AuthenticationOAuth2Config) OAuth2Config ¶
func (aac AuthenticationOAuth2Config) OAuth2Config(provider string) *oauth2.Config
type Config ¶
type Config struct { Postgres PostgresConfig `yaml:"postgres"` Redis RedisConfig `yaml:"redis"` Http HttpConfig `yaml:"http"` Authentication AuthenticationConfig `yaml:"authentication"` FrontendBaseURL string `yaml:"frontend_base_url"` }
func ParseConfig ¶
func ParseConfigFromFile ¶
type Duration ¶
Duration represents a duration with YAML unmarshalling support.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML unmarshals a YAML duration into a time.Duration.
type HttpConfig ¶
type HttpConfig struct { Host string `yaml:"host"` Port int `yaml:"port"` Cors struct { Origin []string `yaml:"origin"` } `yaml:"cors"` }
func (HttpConfig) Address ¶
func (hc HttpConfig) Address() string
type PaginationMeta ¶
type PaginationMeta struct { CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` Count int `json:"count"` Total int `json:"total"` }
func NewPaginationMeta ¶
func NewPaginationMeta(currentPage, count, total int) PaginationMeta
type PostgresConfig ¶
type PostgresConfig struct { Name string `yaml:"name"` User string `yaml:"user"` Password string `yaml:"password"` Host string `yaml:"host"` Port int `yaml:"port"` }
func (PostgresConfig) DSN ¶
func (pc PostgresConfig) DSN() string
type RedisConfig ¶
func (RedisConfig) ConnnectionString ¶
func (rc RedisConfig) ConnnectionString() string
Click to show internal directories.
Click to hide internal directories.