config

package
v0.1.98 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config reads lidza.json, the per-project configuration.

Index

Constants

View Source
const FileName = "lidza.json"

FileName is the project configuration file, at the project root.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name is the application name; also the output binary name.
	Name     string   `json:"name"`
	Frontend Frontend `json:"frontend"`
	// Packs are the enabled packs under packs/, started in this order.
	// `lidza pack scaffold` appends here; packs.go is generated from it.
	Packs []string `json:"packs,omitempty"`
	// SDK names extra generated clients: {"dart": "clients/dart"} writes
	// the Dart package to that directory on every `lidza gen`.
	SDK SDK `json:"sdk,omitempty"`
	// Deploy is what `lidza ship` writes into deploy/production.env: the
	// domains the binary serves over TLS and the ACME contact.
	Deploy Deploy `json:"deploy,omitempty"`
	// AppDir is the directory, relative to the project root, of the Go
	// package that describes the app (routes.go, start.go, tools.go and
	// the generated packs.go). Empty is the root's package main. Set, the
	// package is importable, so the app's tests can live in their own
	// directory (tests/) and main.go only runs it.
	AppDir string `json:"appDir,omitempty"`

	// Dir is the project root the file was read from. Not serialized.
	Dir string `json:"-"`
}

Config is the parsed lidza.json.

func Default

func Default(name, template string) Config

Default returns the configuration `lidza new` writes for a template.

func Load

func Load(dir string) (*Config, error)

Load reads lidza.json from dir.

func (Config) AppPackage

func (c Config) AppPackage() string

AppPackage is the Go package name of the app's package: main at the root, else the last element of AppDir.

func (Config) AppPath

func (c Config) AppPath(rel string) string

AppPath is rel inside the app's package directory (AppDir), relative to the project root: "routes.go" or "app/routes.go".

func (Config) Save

func (c Config) Save(dir string) error

Save writes the configuration to dir/lidza.json.

type Deploy

type Deploy struct {
	// Domains are LIDZA_TLS_DOMAINS: the first is the public name.
	Domains []string `json:"domains,omitempty"`
	// Email is LIDZA_TLS_EMAIL, the ACME account contact.
	Email string `json:"email,omitempty"`
	// Env are the app's production settings that are not secrets
	// (MAIL_PROVIDER, LLM_MODEL, STORAGE_BUCKET): lidza ship writes them
	// into deploy/production.env. Secrets stay in the credentials.
	Env map[string]string `json:"env,omitempty"`
}

Deploy holds the deployment settings `lidza ship --domains` records.

type Frontend

type Frontend struct {
	// Template is the template name: react, svelte, astro or htmx.
	Template string `json:"template"`
	// Dev is the shell command that starts the frontend dev server. Empty
	// for templates without one (htmx).
	Dev string `json:"dev,omitempty"`
	// URL is where the dev server listens; `lidza dev` proxies to it.
	URL string `json:"url,omitempty"`
	// Dist is the build output directory, relative to the project root,
	// embedded into the production binary.
	Dist string `json:"dist,omitempty"`
	// Watch lists directories, relative to the project root, whose files
	// `lidza dev` rebuilds on besides the Go sources: views and static
	// files a Go-rendered frontend embeds.
	Watch []string `json:"watch,omitempty"`
}

Frontend is the "frontend" block: which template the app uses and how the dev proxy reaches its dev server.

func (Frontend) HasDevServer

func (f Frontend) HasDevServer() bool

HasDevServer reports whether the template runs a separate dev server that `lidza dev` must start and proxy to.

type SDK

type SDK struct {
	// Dart is the directory, relative to the project root, of the
	// generated Dart package (lidza_client). Empty disables it.
	Dart string `json:"dart,omitempty"`
}

SDK lists generated clients besides the TypeScript one.

Jump to

Keyboard shortcuts

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