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) GetSystemDatabase(ctx context.Context) (*database.Database, error)
- func (s *Server) HasShortAPIURL() bool
- func (s *Server) JWTSecret() string
- func (s *Server) Logger() *logging.Logger
- func (s *Server) MiddlewareDBE() heligo.Middleware
- func (s *Server) MiddlewareStd() heligo.Middleware
- func (s *Server) MiddlewareWithDbName(dbname string) heligo.Middleware
- func (s *Server) Router() *heligo.Router
- 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)"`
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)"`
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) GetSystemDatabase ¶ added in v0.2.3
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) 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.