Documentation ¶
Index ¶
- func HTTPLogger(logger *logging.Logger) heligo.Middleware
- type Config
- type ConfigOptions
- type Server
- func (s *Server) AllowAnon() bool
- func (s *Server) AnonRole() string
- func (s *Server) BaseAPIURL() string
- func (s *Server) BaseAdminURL() string
- func (s *Server) GetDBE() *database.DbEngine
- func (s *Server) GetDatabase(ctx context.Context, name string) (*database.Database, error)
- func (s *Server) GetLogger() *logging.Logger
- func (s *Server) GetMainDatabase(ctx context.Context) (*database.Database, error)
- func (s *Server) GetRouter() *heligo.Router
- func (s *Server) HasShortAPIURL() bool
- func (s *Server) JWTSecret() string
- func (s *Server) MiddlewareDBE() heligo.Middleware
- func (s *Server) MiddlewareStd() heligo.Middleware
- func (s *Server) MiddlewareWithDbName(dbname string) heligo.Middleware
- func (s *Server) RequestMaxBytes() int64
- func (s *Server) Run()
- func (s *Server) SessionManager() *authn.SessionManager
- func (s *Server) SessionStatistics() authn.SessionStatistics
- func (s *Server) Shutdown(ctx context.Context)
- func (s *Server) Start() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPLogger ¶
func HTTPLogger(logger *logging.Logger) heligo.Middleware
Types ¶
type Config ¶
type Config struct { Address string `comment:"Server address and port (default: 0.0.0.0:4000)"` CertFile string `comment:"TLS certificate file (default: '')"` KeyFile string `comment:"TLS certificate key file (default: '')"` AllowAnon bool `comment:"Allow unauthenticated connections (default: false)"` JWTSecret string `comment:"Secret for JWT tokens"` SessionMode string `comment:"Session mode: none, role (default: role)"` EnableAdminRoute bool `comment:"Enable administration of databases and tables (default: false)"` EnableAdminUI bool `comment:"Enable Admin dashboard (default: false)"` EnableAPIRoute bool `comment:"Enable API access (default: true)"` BaseAPIURL string `comment:"Base URL for the API (default: /api)"` ShortAPIURL bool `comment:"Avoid database name in API URL (needs a single allowed database)"` BaseAdminURL string `comment:"Base URL for the Admin API (default: /admin)"` CORSAllowedOrigins []string `comment:"CORS Access-Control-Allow-Origin (default: [*] for all)"` CORSAllowCredentials bool `comment:"CORS Access-Control-Allow-Credentials (default: false)"` EnableDebugRoute bool `comment:"Enable debug access (default: false)"` PluginDir string `comment:"Plugins' directory (default: ./_plugins)"` Plugins []string `comment:"Ordered list of plugins (default: [])"` ReadTimeout int64 `comment:"The maximum duration (seconds) for reading the entire request, including the body (default: 60)"` WriteTimeout int64 `comment:"The maximum duration before timing out writes of the response (default: 60)"` RequestMaxBytes int64 `comment:"Max bytes allowed in requests, to limit the size of incoming request bodies (default: 1M, 0 for unlimited)"` Database database.Config `comment:"Database configuration"` Logging logging.Config `comment:"Logging configuration"` }
Config holds the current configuration
type ConfigOptions ¶
type Server ¶
type Server struct { Config *Config DBE *database.DbEngine HTTP *http.Server OnBeforeStart func(*Server) OnBeforeShutdown func(*Server) // contains filtered or unexported fields }
func NewServerWithConfig ¶
func NewServerWithConfig(config map[string]any, configOpts *ConfigOptions) (*Server, error)
func (*Server) BaseAPIURL ¶ added in v0.2.2
func (*Server) BaseAdminURL ¶ added in v0.2.2
func (*Server) GetDatabase ¶ added in v0.2.3
func (*Server) GetMainDatabase ¶ added in v0.2.4
func (*Server) HasShortAPIURL ¶ added in v0.2.2
func (*Server) MiddlewareDBE ¶ added in v0.2.2
func (s *Server) MiddlewareDBE() heligo.Middleware
func (*Server) MiddlewareStd ¶ added in v0.2.2
func (s *Server) MiddlewareStd() heligo.Middleware
func (*Server) MiddlewareWithDbName ¶ added in v0.2.2
func (s *Server) MiddlewareWithDbName(dbname string) heligo.Middleware
func (*Server) RequestMaxBytes ¶ added in v0.2.6
func (*Server) SessionManager ¶ added in v0.2.2
func (s *Server) SessionManager() *authn.SessionManager
func (*Server) SessionStatistics ¶ added in v0.2.2
func (s *Server) SessionStatistics() authn.SessionStatistics
Click to show internal directories.
Click to hide internal directories.