config

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = "zyra.config.json"

ConfigFileName is the conventional name of a Zyra project's configuration file.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	// Enabled turns the SSR page cache on or off.
	Enabled bool `json:"enabled"`
	// TTL is the number of seconds a cached page remains valid
	// before it is evicted and the next request re-renders it.
	// Must be > 0 when Enabled is true. Defaults to 60.
	TTL int `json:"ttl"`
	// Routes is the list of exact URL paths whose SSR output should
	// be cached. An empty slice means no routes are cached even if
	// Enabled is true.
	Routes []string `json:"routes"`
}

CacheConfig controls Zyra's server-side SSR page cache, which stores the fully-rendered HTML for a set of routes in memory so subsequent requests are served without calling the Bun SSR worker.

type Config

type Config struct {
	Port         int            `json:"port"`
	OutDir       string         `json:"outDir"`
	ActionsDir   string         `json:"actionsDir"`
	PagesDir     string         `json:"pagesDir"`
	PublicDir    string         `json:"publicDir"`
	DevMode      bool           `json:"devMode"`
	SSR          bool           `json:"ssr"`
	BasePath     string         `json:"basePath"`
	Language     string         `json:"language"`
	Architecture string         `json:"architecture,omitempty"`
	CSS          string         `json:"css"`
	Tailwind     TailwindConfig `json:"tailwind"`
	Cache        CacheConfig    `json:"cache"`
}

Config represents the parsed zyra.config.json file.

func Default

func Default() *Config

Default returns a Config populated with Zyra's default values.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and parses a zyra.config.json file at the given path, falling back to Zyra's defaults for any field that is missing from the file. If the file does not exist, the default configuration is returned unmodified and no error is raised. If the file exists but is empty, defaults are also returned. Any values present in the file are validated before being returned.

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures the configuration values are usable, returning a single error that describes every invalid field found.

type TailwindConfig

type TailwindConfig struct {
	Content []string               `json:"content"`
	Theme   map[string]interface{} `json:"theme,omitempty"`
}

TailwindConfig holds the Tailwind CSS specific configuration for a Zyra project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL