Documentation
¶
Index ¶
- Constants
- func CreateApplyJobBuiltin() *starlark.Builtin
- func CreateApplySidecarBuiltin() *starlark.Builtin
- func CreateBuiltin(nodeConfig types.NodeConfig, allowedEnv []string) starlark.StringDict
- func CreateConfigBuiltin(nodeConfig types.NodeConfig, allowedEnv []string) ...
- func GetBoolAttr(s starlark.HasAttrs, key string) (bool, error)
- func GetBoolPtrAttr(s starlark.HasAttrs, key string) (*bool, error)
- func GetCallableAttr(s starlark.HasAttrs, key string) (starlark.Callable, error)
- func GetDictAttr(s starlark.HasAttrs, key string, optional bool) (map[string]any, error)
- func GetDictStringAttr(s starlark.HasAttrs, key string, optional bool) (map[string]string, error)
- func GetIntAttr(s starlark.HasAttrs, key string) (int64, error)
- func GetListListStringAttr(s starlark.HasAttrs, key string, optional bool) ([][]string, error)
- func GetListMapAttr(s starlark.HasAttrs, key string, optional bool) ([]map[string]any, error)
- func GetListStringAttr(s starlark.HasAttrs, key string, optional bool) ([]string, error)
- func GetOptionalBoolAttr(s starlark.HasAttrs, key string) (bool, error)
- func GetOptionalStringAttr(s starlark.HasAttrs, key string) (string, error)
- func GetStringAttr(s starlark.HasAttrs, key string) (string, error)
- func GetStringList(list *starlark.List) ([]string, error)
- func JobStruct(spec types.JobSpec, run starlark.Callable) *starlarkstruct.Struct
- func LoadParamInfo(fileName string, data []byte, serverConfig *types.ServerConfig) (map[string]AppParam, error)
- func LoadStoreInfo(fileName string, data []byte) (*starlark_type.StoreInfo, error)
- func MergeAppDef(appDef *starlarkstruct.Struct, actions, permissions []starlark.Value) (*starlarkstruct.Struct, error)
- func ParamStringToType(name string, typeName starlark_type.TypeName, valueStr string) (starlark.Value, error)
- func ParseTriggerValue(v starlark.Value) (*types.JobTrigger, error)
- func ReadActionsFile(fileName string, globals starlark.StringDict) (actions, permissions []starlark.Value, err error)
- func ReadParamInfo(fileName string, inp []byte, serverConfig *types.ServerConfig) (map[string]AppParam, error)
- func ReadStoreInfo(fileName string, inp []byte) (*starlark_type.StoreInfo, error)
- func SpecEntries(s starlark.HasAttrs, key, specAttr string, parse func(string) (string, error)) ([]string, error)
- func TriggerBuiltins() starlark.StringDict
- func UnpackJobArgs(fnName string, args starlark.Tuple, kwargs []starlark.Tuple, allowRun bool) (types.JobSpec, starlark.Callable, error)
- type AppParam
- type CodeConfig
- type ContainerConfig
- type DeferEntry
- type DeferFunc
- type DisplayType
- type HtmxConfig
- type RouteConfig
- type StreamValue
Constants ¶
const ( DEFAULT_MODULE = "ace" DOC_MODULE = "doc" TABLE_MODULE = "table" PARAM_MODULE = "param" APP = "app" HTML = "html" API = "api" PROXY = "proxy" FRAGMENT = "fragment" STYLE = "style" REDIRECT = "redirect" PERMISSION = "permission" RESPONSE = "response" CONFIG = "config" LIBRARY = "library" ACTION = "action" RESULT = "result" AUDIT = "audit" OUTPUT = "output" CONTAINER_URL = "<CONTAINER_URL>" // special url to use for proxying to the container DEFAULT_REDIRECT_CODE = 303 )
const ( DEFAULT_DAISYUI_LIGHT_THEME = "emerald" DEFAULT_DAISYUI_DARK_THEME = "night" // Default themes for the action UI when the app defines no style // config. These are the OpenRun brand themes baked into the embedded // fallback stylesheet (internal/webstatic/static/style.css) DEFAULT_ACTION_LIGHT_THEME = "openrun-light" DEFAULT_ACTION_DARK_THEME = "openrun-dark" )
const ( // Constants included in the ace builtin module GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" HTML_TYPE = "HTML" JSON = "JSON" TEXT = "TEXT" READ = "READ" WRITE = "WRITE" AUTO = "AUTO" TABLE = "TABLE" DOWNLOAD = "DOWNLOAD" IMAGE = "IMAGE" )
const ( APP_FILE_NAME = "app.star" APP_CONFIG_KEY = "app" DEFAULT_HANDLER = "handler" ERROR_HANDLER = "error_handler" METHODS_DELIMITER = "," CONFIG_LOCK_FILE_NAME = "config_gen.lock" SCHEMA_FILE_NAME = "schema.star" PARAMS_FILE_NAME = "params.star" // ACTIONS_FILE_NAME is the optional convention file declaring actions // (and permissions) outside app.star, so an app built from a spec can add // actions without owning the spec's app.star ACTIONS_FILE_NAME = "actions.star" // ACTION_PARAMS_FILE_NAME declares the params shown on the action // surfaces; when present, only its params are shown (see spec-actions.md) ACTION_PARAMS_FILE_NAME = "action_params.star" // ACTIONS_KEY and ACTION_PERMISSIONS_KEY are the globals read from actions.star ACTIONS_KEY = "actions" ACTION_PERMISSIONS_KEY = "permissions" // BUILTIN_PLUGIN_SUFFIX is the standard plugin module suffix: // load("store.in", "store"). Resolution prefers a module compiled into // the binary and falls back to an external provider serving that name BUILTIN_PLUGIN_SUFFIX = "in" // EXTERNAL_PLUGIN_SUFFIX explicitly requires the module's external // (out-of-process plugin provider) build: load("store.ex", "store") EXTERNAL_PLUGIN_SUFFIX = "ex" STARLARK_FILE_SUFFIX = ".star" INDEX_FILE = "index.go.html" INDEX_GEN_FILE = "index_gen.go.html" CLACE_GEN_FILE = "openrun_gen.go.html" ACCOUNT_SEPARATOR = "#" )
const ( JOB = "job" SIDECAR = "sidecar" CRON = "cron" BEFORE_DEPLOY = "before_deploy" MANUAL = "manual" // JOB_SPEC_ATTR holds the canonical JobSpec JSON on a job struct; // SIDECAR_SPEC_ATTR the SidecarSpec JSON on a sidecar struct JOB_SPEC_ATTR = "spec" SIDECAR_SPEC_ATTR = "spec" JOB_RUN_ATTR = "run" )
const ( TYPE = "type" FIELD = "field" INDEX = "index" )
const (
PARAM = "param"
)
Variables ¶
This section is empty.
Functions ¶
func CreateApplyJobBuiltin ¶ added in v0.19.4
CreateApplyJobBuiltin returns the apps.ace job builtin: the ace.job fields without run
func CreateApplySidecarBuiltin ¶ added in v0.19.4
CreateApplySidecarBuiltin returns the apps.ace sidecar builtin, producing a struct carrying the canonical SidecarSpec JSON. The container.sidecar plugin call is the app.star counterpart
func CreateBuiltin ¶
func CreateBuiltin(nodeConfig types.NodeConfig, allowedEnv []string) starlark.StringDict
func CreateConfigBuiltin ¶
func GetBoolPtrAttr ¶ added in v0.20.0
GetBoolPtrAttr returns the bool attr, nil when the attr is absent: for tri-state settings where a declared False differs from not declared
func GetCallableAttr ¶
func GetDictAttr ¶
func GetDictStringAttr ¶ added in v0.17.5
func GetListListStringAttr ¶
func GetListMapAttr ¶
func GetListStringAttr ¶
func GetOptionalStringAttr ¶
func LoadParamInfo ¶
func LoadStoreInfo ¶
func LoadStoreInfo(fileName string, data []byte) (*starlark_type.StoreInfo, error)
func MergeAppDef ¶ added in v0.20.0
func MergeAppDef(appDef *starlarkstruct.Struct, actions, permissions []starlark.Value) (*starlarkstruct.Struct, error)
MergeAppDef returns a copy of the ace.app struct with the given actions and permissions appended to its lists, in that order after the app.star entries
func ParamStringToType ¶
func ParseTriggerValue ¶ added in v0.19.4
func ParseTriggerValue(v starlark.Value) (*types.JobTrigger, error)
ParseTriggerValue converts a trigger argument to a JobTrigger: a struct from cron()/before_deploy()/manual(), a dict in the JSON form ({"type": "cron", "schedule": ...}), or None for manual
func ReadActionsFile ¶ added in v0.20.0
func ReadActionsFile(fileName string, globals starlark.StringDict) (actions, permissions []starlark.Value, err error)
ReadActionsFile reads the globals of an actions.star file: the required "actions" list of ace.action values and the optional "permissions" list of ace.permission values. fileName is used in the error messages
func ReadParamInfo ¶
func ReadStoreInfo ¶
func ReadStoreInfo(fileName string, inp []byte) (*starlark_type.StoreInfo, error)
func SpecEntries ¶ added in v0.19.4
func SpecEntries(s starlark.HasAttrs, key, specAttr string, parse func(string) (string, error)) ([]string, error)
SpecEntries reads a list attribute holding job or sidecar declarations in any accepted form (JSON strings, dicts, or structs from the builtins) and returns the canonical JSON of each, validated by parse. nil for an empty list, so apply change detection compares equal to a stored nil
func TriggerBuiltins ¶ added in v0.19.4
func TriggerBuiltins() starlark.StringDict
TriggerBuiltins returns the trigger builtins shared by app.star (under ace) and apps.ace (top level)
func UnpackJobArgs ¶ added in v0.19.4
func UnpackJobArgs(fnName string, args starlark.Tuple, kwargs []starlark.Tuple, allowRun bool) (types.JobSpec, starlark.Callable, error)
UnpackJobArgs parses the job builtin arguments shared by ace.job (app.star) and job (apps.ace). allowRun accepts the run callable; the declaration surface has no callables
Types ¶
type AppParam ¶
type AppParam struct {
Index int
Name string
Description string
Required bool
Type starlark_type.TypeName
DefaultValue starlark.Value
DisplayType DisplayType
DisplayTypeOptions string
}
AppParam represents a parameter in an app.
type CodeConfig ¶
type CodeConfig struct {
Routing RouteConfig `json:"routing"`
Htmx HtmxConfig `json:"htmx"`
Container ContainerConfig `json:"container"`
}
func NewCodeConfig ¶
func NewCodeConfig() *CodeConfig
NewCodeConfig creates an CodeConfig with default values. This config is used when lock file is not present. The config file load order is
DefaultCodeConfig -> StarlarkCodeConfig
func NewCompatibleCodeConfig ¶
func NewCompatibleCodeConfig() *CodeConfig
NewCompatibleCodeConfig creates an CodeConfig focused on maintaining backward compatibility. This is used when the app is created from a source url where the source has the config lock file present. The configs are read in the order
CompatibleCodeConfig -> LockFile -> StarlarkCodeConfig
The goal is that if the application has a lock file, then all settings will attempt to be locked such that there should not be any change in behavior when the OpenRun version is updated. Removing the lock file will result in new config defaults getting applied, which can be done when the app developer wants to do an application refresh. Refresh will require additional testing to ensure that UI functionality is not changed..
type ContainerConfig ¶ added in v0.18.3
type ContainerConfig struct {
SeparateStageProdImages bool `json:"separate_stage_prod_images"`
}
type DeferEntry ¶
type DisplayType ¶
type DisplayType string
const ( DisplayTypePassword DisplayType = "password" DisplayTypeTextArea DisplayType = "textarea" DisplayTypeFileUpload DisplayType = "file" // DisplayTypeCombo loosens a dropdown param (list options or suggest // values) to allow free text entry. Without it dropdowns are strict: // the value must be one of the listed options DisplayTypeCombo DisplayType = "combo" )
type HtmxConfig ¶
type HtmxConfig struct {
Version string `json:"version"`
}
type RouteConfig ¶
type RouteConfig struct {
TemplateLocations []string `json:"template_locations"`
BaseTemplates string `json:"base_templates"`
PushEvents bool `json:"push_events"`
EarlyHints bool `json:"early_hints"`
// glob patterns for files which are excluded from container content change check
ContainerExclude []string `json:"container_exclude"`
}
type StreamValue ¶ added in v0.20.0
type StreamValue interface {
StartStream() (func(yield func(any, error) bool), error)
CloseStream()
}
StreamValue is implemented by the response of a plugin call made with stream=True (exec.run, container.run, container_logs_stream). The value is opaque in Starlark; the framework consumes it as a range function yielding output chunks (plain strings, or maps for parsed output) and a terminal error. StartStream detaches the stream from the request's plugin cleanup and must be called before that cleanup runs; CloseStream releases the producer (killing a still running command) and is safe to call more than once