Documentation
¶
Index ¶
- Constants
- func Env(key, fallback string) string
- func EnvBool(key string, fallback bool) bool
- func EnvDuration(key string, fallback time.Duration) time.Duration
- func EnvInt(key string, fallback int) int
- func EnvList(key string, fallback []string) []string
- func GenerateSecretKey() (string, error)
- func IsConfigured() bool
- func Load(sources ...Source) error
- func LoadDotEnv(paths ...string) error
- func MustLoad(sources ...Source)
- func MustLoadDotEnv(paths ...string)
- func Preset(name string) func(*Settings)
- func Reset()
- type Admin
- type Auth
- type CORS
- type Cache
- type CacheBackend
- type Database
- type Email
- type EmailBackend
- type Engine
- type File
- type I18N
- type ImproperlyConfigured
- type Jobs
- type Logging
- type Map
- type Migrations
- type PageCache
- type Pagination
- type Profile
- type RateLimit
- type SameSite
- type Security
- type Server
- type SessionBackend
- type Sessions
- type Settings
- func (s Settings) Addr() string
- func (s Settings) AutoReloadTemplates() bool
- func (s Settings) BaseURL() string
- func (s Settings) Cache() Cache
- func (s Settings) CacheByAlias(alias string) (Cache, bool)
- func (s Settings) CommandOverrides() []string
- func (s Settings) Database() Database
- func (s Settings) DatabaseByAlias(alias string) (Database, bool)
- func (s Settings) IsDeployed() bool
- func (s Settings) IsDevelopment() bool
- func (s Settings) IsProduction() bool
- func (s Settings) IsStaging() bool
- func (s Settings) LogLevel() slog.Level
- func (s Settings) Path(elements ...string) string
- func (s Settings) Scheme() string
- func (s Settings) SecretKeyGenerated() bool
- type Source
- type Static
- type TLS
- type Templates
- type Uploads
Constants ¶
View Source
const ( DefaultRedisAddress = "127.0.0.1:6379" DefaultCacheDir = "cache" )
View Source
const ( DefaultEmailDir = "mail" DefaultEmailTimeout = 10 * time.Second )
View Source
const DefaultCSP = "default-src 'self'; " +
"script-src 'self' {nonce}; " +
"style-src 'self' {nonce}; " +
"img-src 'self' data:; " +
"object-src 'none'; " +
"base-uri 'self'; " +
"frame-ancestors 'none'"
View Source
const DefaultFrameOptions = "DENY"
View Source
const DefaultPermissionsPolicy = "camera=(), microphone=(), geolocation=()"
View Source
const DefaultSQLiteName = "coyote.db"
Variables ¶
This section is empty.
Functions ¶
func GenerateSecretKey ¶
func IsConfigured ¶
func IsConfigured() bool
func LoadDotEnv ¶
func MustLoadDotEnv ¶
func MustLoadDotEnv(paths ...string)
Types ¶
type CORS ¶
type CORS struct {
Origins []string
Methods []string
Headers []string
ExposeHeaders []string
AllowCredentials bool
MaxAge time.Duration
}
func (CORS) AllowsAnyOrigin ¶
func (CORS) HeaderList ¶
func (CORS) MethodList ¶
type Cache ¶
type Cache struct {
Alias string
Backend CacheBackend
TTL time.Duration
Prefix string
Version string
Address string
Username string
Password string
Database int
TLS *tls.Config
Dir string
MaxEntries int
MaxBytes int64
CleanupInterval time.Duration
PoolSize int
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
Store cache.Cache
}
func MemoryCache ¶
func RedisCache ¶
type CacheBackend ¶
type CacheBackend string
const ( CacheInMemory CacheBackend = "memory" CacheInRedis CacheBackend = "redis" CacheInFile CacheBackend = "file" )
type Database ¶
type Database struct {
Alias string
Engine Engine
Name string
Host string
Port int
User string
Password string
Options map[string]string
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime time.Duration
ConnMaxIdleTime time.Duration
}
func SQLiteDatabase ¶
type Email ¶
type EmailBackend ¶
type EmailBackend string
const ( EmailToSMTP EmailBackend = "smtp" EmailToConsole EmailBackend = "console" EmailToFile EmailBackend = "file" EmailToMemory EmailBackend = "memory" )
type File ¶
func RequiredDotEnv ¶
type I18N ¶
type ImproperlyConfigured ¶
type ImproperlyConfigured struct {
Problems []string
}
func (*ImproperlyConfigured) Error ¶
func (e *ImproperlyConfigured) Error() string
type Jobs ¶
type Jobs struct {
Enabled bool
Queue jobs.Queue
Queues []string
Workers int
MaxAttempts int
Backoff time.Duration
BackoffCeiling time.Duration
ClaimTimeout time.Duration
DrainTimeout time.Duration
PollInterval time.Duration
DoneTTL time.Duration
}
func (Jobs) QueueNames ¶
func (Jobs) RunsWorkers ¶
type Migrations ¶
type Migrations struct {
Dir string
}
type PageCache ¶
type Pagination ¶
type Server ¶
type SessionBackend ¶
type SessionBackend string
const ( SessionsInMemory SessionBackend = "memory" SessionsInDB SessionBackend = "database" SessionsInCookie SessionBackend = "cookie" )
func (SessionBackend) Persistent ¶
func (b SessionBackend) Persistent() bool
func (SessionBackend) Stateless ¶
func (b SessionBackend) Stateless() bool
type Settings ¶
type Settings struct {
Debug bool
Environment Profile
SecretKey string
AllowedHosts []string
BaseDir string
Databases []Database
Caches []Cache
Server Server
Security Security
Migrations Migrations
Sessions Sessions
Auth Auth
I18N I18N
TimeZone string
Templates Templates
PageCache PageCache
Pagination Pagination
Uploads Uploads
Static Static
Admin Admin
Logging Logging
Email Email
Jobs Jobs
// contains filtered or unexported fields
}
func (Settings) AutoReloadTemplates ¶
func (Settings) CommandOverrides ¶
func (Settings) IsDeployed ¶
func (Settings) IsDevelopment ¶
func (Settings) IsProduction ¶
func (Settings) SecretKeyGenerated ¶
Source Files
¶
- accessors.go
- cache.go
- configure.go
- cors.go
- database.go
- defaults.go
- dotenv.go
- email.go
- env.go
- i18n.go
- jobs.go
- normalize.go
- normalize_cache.go
- normalize_email.go
- pagecache.go
- profile.go
- ratelimit.go
- secret.go
- security.go
- session_backend.go
- settings.go
- source.go
- tls.go
- validate.go
- validate_app.go
- validate_cache.go
- validate_core.go
- validate_database.go
- validate_email.go
- validate_i18n.go
- validate_jobs.go
- validate_server.go
Click to show internal directories.
Click to hide internal directories.