Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type ServerHandler
- func (h *ServerHandler) CreateTemplateServer(progress chan<- string) error
- func (h *ServerHandler) Logger(messages ...any)
- func (h *ServerHandler) MainInputFileRelativePath() string
- func (h *ServerHandler) Name() string
- func (h *ServerHandler) NewFileEvent(fileName, extension, filePath, event string) error
- func (h *ServerHandler) RestartServer() error
- func (h *ServerHandler) SetBuildOnDisk(onDisk bool)
- func (h *ServerHandler) SetExternalServerMode(external bool)
- func (h *ServerHandler) SetLog(f func(message ...any))
- func (h *ServerHandler) StartServer(wg *sync.WaitGroup)
- func (h *ServerHandler) StopServer() error
- func (h *ServerHandler) SupportedExtensions() []string
- func (h *ServerHandler) UnobservedFiles() []string
- type ServerModeHandler
- type ServerStrategy
- type Store
- type UI
Constants ¶
const StoreKeyExternalServer = "server_external_mode"
Variables ¶
var TestMode bool
TestMode is a global flag to indicate the server is running in a test environment. This is used to disable aggressive cleanups and other disruptive behaviors.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AppRootDir string // e.g., /home/user/project (application root directory)
SourceDir string // directory location of main.go e.g., src/cmd/appserver (relative to AppRootDir)
OutputDir string // compilation and execution directory e.g., deploy/appserver (relative to AppRootDir)
PublicDir string // default public dir for generated server (e.g., src/web/public)
MainInputFile string // main input file name (default: "main.go", can be "server.go", etc.)
ArgumentsForCompilingServer func() []string // e.g., []string{"-X 'main.version=v1.0.0'"}
ArgumentsToRunServer func() []string // e.g., []string{"dev"}
AppPort string // e.g., 8080
Routes []func(*http.ServeMux) // Functions to register routes on the HTTP server
DisableGlobalCleanup bool // If true, disables global cleanup in gorun during restarts
ExitChan chan bool // Global channel to signal shutdown
}
type ServerHandler ¶
type ServerHandler struct {
*Config
// contains filtered or unexported fields
}
func New ¶
func New(c *Config) *ServerHandler
func (*ServerHandler) CreateTemplateServer ¶ added in v0.1.16
func (h *ServerHandler) CreateTemplateServer(progress chan<- string) error
CreateTemplateServer switches from In-Memory to External mode. It generates the server files (if not present), compiles, and runs them. This implements the transition from "In-Memory" to "Permanent" (External) mode.
func (*ServerHandler) Logger ¶ added in v0.1.21
func (h *ServerHandler) Logger(messages ...any)
func (*ServerHandler) MainInputFileRelativePath ¶
func (h *ServerHandler) MainInputFileRelativePath() string
MainInputFileRelativePath returns the path relative to AppRootDir (e.g., "src/cmd/appserver/main.go")
func (*ServerHandler) Name ¶ added in v0.1.21
func (h *ServerHandler) Name() string
func (*ServerHandler) NewFileEvent ¶
func (h *ServerHandler) NewFileEvent(fileName, extension, filePath, event string) error
event: create,write,remove,rename
func (*ServerHandler) RestartServer ¶
func (h *ServerHandler) RestartServer() error
func (*ServerHandler) SetBuildOnDisk ¶ added in v0.1.19
func (h *ServerHandler) SetBuildOnDisk(onDisk bool)
SetBuildOnDisk sets whether the server artifacts should be written to disk.
func (*ServerHandler) SetExternalServerMode ¶ added in v0.1.19
func (h *ServerHandler) SetExternalServerMode(external bool)
SetExternalServerMode switches between Internal and External server strategies.
func (*ServerHandler) SetLog ¶ added in v0.1.21
func (h *ServerHandler) SetLog(f func(message ...any))
func (*ServerHandler) StartServer ¶
func (h *ServerHandler) StartServer(wg *sync.WaitGroup)
StartServer initiates the server using the current strategy (In-Memory or External)
func (*ServerHandler) StopServer ¶ added in v0.1.24
func (h *ServerHandler) StopServer() error
StopServer stops the server and waits for the port to be released.
func (*ServerHandler) SupportedExtensions ¶
func (h *ServerHandler) SupportedExtensions() []string
func (*ServerHandler) UnobservedFiles ¶
func (h *ServerHandler) UnobservedFiles() []string
UnobservedFiles returns the list of files that should not be tracked by file watchers
type ServerModeHandler ¶ added in v0.1.19
type ServerModeHandler struct {
// contains filtered or unexported fields
}
func NewServerModeHandler ¶ added in v0.1.19
func NewServerModeHandler(h *ServerHandler, db Store, ui UI) *ServerModeHandler
func (*ServerModeHandler) Execute ¶ added in v0.1.19
func (s *ServerModeHandler) Execute()
func (*ServerModeHandler) Label ¶ added in v0.1.19
func (s *ServerModeHandler) Label() string
func (*ServerModeHandler) Name ¶ added in v0.1.19
func (s *ServerModeHandler) Name() string
func (*ServerModeHandler) SetLog ¶ added in v0.1.21
func (s *ServerModeHandler) SetLog(f func(message ...any))