Documentation
¶
Index ¶
- type Auth
- func (a *Auth) AccountID() (string, error)
- func (a *Auth) GetSteps() []*wizard.Step
- func (a *Auth) IsConfigured() bool
- func (a *Auth) PagesToken() (string, error)
- func (a *Auth) ProjectName() (string, error)
- func (a *Auth) SetLog(f func(...any))
- func (a *Auth) Setup(accountID, bootstrapToken, projectName string) error
- type Config
- type Goflare
- func (g *Goflare) Auth() *Auth
- func (h *Goflare) Change(newValue string, progress func(msgs ...any))
- func (g *Goflare) DeployPages() error
- func (g *Goflare) GeneratePagesFiles() error
- func (g *Goflare) GenerateWorkerFiles() error
- func (h *Goflare) Label() string
- func (g *Goflare) Logger(messages ...any)
- func (h *Goflare) MainInputFileRelativePath() string
- func (h *Goflare) Name() string
- func (h *Goflare) NewFileEvent(fileName, extension, filePath, event string) error
- func (g *Goflare) SetCompilerMode(newValue string)
- func (g *Goflare) SetKeys(keys KeyManager)
- func (g *Goflare) SetLog(f func(message ...any))
- func (h *Goflare) Shortcuts() []map[string]string
- func (h *Goflare) SupportedExtensions() []string
- func (h *Goflare) UnobservedFiles() []string
- func (h *Goflare) Value() string
- type KeyManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶ added in v0.0.97
type Auth struct {
Keys KeyManager
// contains filtered or unexported fields
}
Auth handles Cloudflare API authentication and scoped token creation.
func NewAuth ¶ added in v0.0.97
func NewAuth(keys KeyManager) *Auth
NewAuth creates an Auth instance backed by the provided KeyManager.
func NewAuthWithBaseURL ¶ added in v0.0.97
func NewAuthWithBaseURL(keys KeyManager, baseURL string) *Auth
NewAuthWithBaseURL creates an Auth instance with a custom API base URL (for testing).
func (*Auth) GetSteps ¶ added in v0.0.97
GetSteps implements the interface expected by tinywasm/wizard.New(). The wizard orchestrates three steps to configure Cloudflare Pages auth.
func (*Auth) IsConfigured ¶ added in v0.0.97
IsConfigured returns true if a scoped Pages token exists in the keyring.
func (*Auth) PagesToken ¶ added in v0.0.97
PagesToken retrieves the stored scoped Pages token.
func (*Auth) ProjectName ¶ added in v0.0.97
ProjectName retrieves the stored Cloudflare Pages project name.
type Config ¶
type Config struct {
AppRootDir string // default: "."
RelativeInputDirectory func() string // input relative directory for source code server app.go to deploy app.wasm (relative) default: "web"
RelativeOutputDirectory func() string // output relative directory for worker.js and app.wasm file (relative) default: "deploy/cloudflare"
MainInputFile string // eg: "main.go"
CompilingArguments func() []string
OutputWasmFileName string // WASM file name (default: "worker.wasm")
BuildPageFunctionShortcut string // build assets wasm,js, json files to pages functions (default: "f")
BuildWorkerShortcut string // build assets wasm,js, json files to workers (default: "w")
}
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with all default values set AppRootDir=".", RelativeInputDirectory="web", RelativeOutputDirectory="deploy/cloudflare", MainInputFile="main.worker.go", OutputWasmFileName="worker.wasm"
type Goflare ¶
type Goflare struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new Goflare instance with the provided configuration Timeout is set to 40 seconds maximum as TinyGo compilation can be slow Default values: AppRootDir=".", RelativeOutputDirectory="deploy/cloudflare", MainInputFile="main.worker.go", OutputWasmFileName="app.wasm"
func NewForTest ¶ added in v0.0.97
func NewForTest(c *Config, keys KeyManager, cfBaseURL string) *Goflare
NewForTest creates a Goflare instance with injected KeyManager and CF API base URL. Intended for use in tests only.
func (*Goflare) Auth ¶ added in v0.0.97
Auth returns the Auth instance. Returns nil if SetKeys was not called.
func (*Goflare) DeployPages ¶ added in v0.0.97
DeployPages uploads the compiled WASM + JS wrapper to Cloudflare Pages using the Direct Upload API (no Wrangler CLI required).
Reads account_id, pages_token, and pages_project from the keyring. Output files must have been generated by GeneratePagesFiles() first.
func (*Goflare) GeneratePagesFiles ¶
GeneratePagesFiles generates all necessary files for Cloudflare Pages Functions using Advanced Mode generates the _worker.js file for Pages (Advanced Mode) https://developers.cloudflare.com/pages/functions/advanced-mode/ This creates a single combined file with wasm_exec.js and runtime.mjs inline
func (*Goflare) GenerateWorkerFiles ¶
func (*Goflare) MainInputFileRelativePath ¶
MainInputFileRelativePath returns the relative path to the main input file This is used by devwatch to determine file ownership for Go files
func (*Goflare) NewFileEvent ¶
NewFileEvent handles file change events for goflare This method is called by devwatch when a relevant file changes
func (*Goflare) SetCompilerMode ¶
SetCompilerMode changes the compiler mode mode: "L" (Large fast/Go), "M" (Medium TinyGo debug), "S" (Small TinyGo production)
func (*Goflare) SetKeys ¶ added in v0.0.97
func (g *Goflare) SetKeys(keys KeyManager)
SetKeys injects the KeyManager used for Cloudflare credentials. Must be called before Auth() or DeployPages().
func (*Goflare) SupportedExtensions ¶
SupportedExtensions returns the file extensions that goflare monitors For edge workers, we primarily watch .go files
func (*Goflare) UnobservedFiles ¶
UnobservedFiles returns files that should be ignored by the file watcher These are output files generated by goflare that shouldn't trigger recompilation