{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stackfile\n\n## Constants\n\n```go\nconst MaxStackfileSize = 1 \u003c\u003c 20 // 1MB\n\n```\n\n```go\nconst (\n\tPostgresAddonType = \"postgres\"\n)\n```\n\n## Variables\n\n```go\nvar SchemaJSON []byte\n```\nSchemaJSON is the JSON Schema (draft-07) for stackfile documents.\n\n## Functions\n\n```go\nfunc ResolveStack(ctx context.Context, stack *openapi.Stack, resolver Resolver) error\n```\n\n```go\nfunc Validate(sf *Stackfile) error\n```\n\n## Types\n\n```go\ntype AddonConnectionConfig struct {\n\tType string `yaml:\"type\"`\n\t// Env vars templated from the addon's outputs. Output names are bare —\n\t// no addon prefix (the block already names the addon):\n\t// env:\n\t//   POSTGRES_HOST: \"{{ host }}\"\n\t//   POSTGRES_URI: \"postgres://{{ username }}:{{ password }}@{{ host }}:{{ port }}/{{ database }}\"\n\tEnv      map[string]string    `yaml:\"env\"`\n\tPostgres *PostgresAddonConfig `yaml:\"-\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (a *AddonConnectionConfig) UnmarshalYAML(node *yaml.Node) error\n```\n\n```go\ntype BuildConfig struct {\n\tRepo       string `yaml:\"repo,omitempty\"`\n\tBranch     string `yaml:\"branch,omitempty\"`\n\tTag        string `yaml:\"tag,omitempty\"`\n\tCommit     string `yaml:\"commit,omitempty\"`\n\tDockerfile string `yaml:\"dockerfile,omitempty\"`\n\tContext    string `yaml:\"context,omitempty\"`\n\tGitSecret  string `yaml:\"git_secret,omitempty\"`\n}\n```\n\n```go\ntype PortDef struct {\n\tName      string `yaml:\"name\"`\n\tPort      int32  `yaml:\"port\"`\n\tProtocol  string `yaml:\"protocol,omitempty\"`\n\tPublic    bool   `yaml:\"public,omitempty\"`\n\tSubdomain string `yaml:\"subdomain,omitempty\"`\n}\n```\n\n```go\ntype PostgresAddonConfig struct {\n\tDatabase  string `yaml:\"database,omitempty\"`\n\tSuperuser bool   `yaml:\"superuser,omitempty\"`\n}\n```\n\n```go\ntype Resolver interface {\n\tResolveSecretByName(ctx context.Context, name string) (string, error)\n\tResolveAddonByName(ctx context.Context, addonType, name string) (string, error)\n}\n```\n\n```go\ntype Resource struct {\n\tImage   string            `yaml:\"image,omitempty\"`\n\tBuild   *BuildConfig      `yaml:\"build,omitempty\"`\n\tCommand []string          `yaml:\"command,omitempty\"`\n\tArgs    []string          `yaml:\"args,omitempty\"`\n\tPorts   []PortDef         `yaml:\"ports,omitempty\"`\n\tEnv     map[string]string `yaml:\"env,omitempty\"`\n\t// Secret Name -\u003e Mapping of secret keys to env var names\n\tSecrets map[string]SecretMapping `yaml:\"secrets,omitempty\"`\n\t// Addon Name -\u003e Connection Config\n\tAddons       map[string]AddonConnectionConfig `yaml:\"addons,omitempty\"`\n\tVolumes      []VolumeMountDef                 `yaml:\"volumes,omitempty\"`\n\tDependsOn    []string                         `yaml:\"depends_on,omitempty\"`\n\tWorkloadType string                           `yaml:\"workload_type,omitempty\"`\n\tSchedule     string                           `yaml:\"schedule,omitempty\"`\n\tReplicas     *int32                           `yaml:\"replicas,omitempty\"`\n}\n```\n\n```go\ntype SecretMapping map[string]string\n```\nSecretMapping maps secret keys to env var names. Key = env var name, Value = secret key\n\n```go\ntype Stackfile struct {\n\tName      string               `yaml:\"name\"`\n\tResources map[string]Resource  `yaml:\"resources\"`\n\tVolumes   map[string]VolumeDef `yaml:\"volumes,omitempty\"`\n}\n```\n\n```go\nfunc FromStack(stack *openapi.Stack) (*Stackfile, error)\n```\nFromStack converts an API Stack document back into a Stackfile.\n\nIt covers exactly the subset a stackfile can express. Constructs outside that subset (init containers, file targets, build-artifact connections, volume sources, registry credentials, ...) fail with an error naming the construct — never silently dropped. Connections must carry name-based node refs; id-only refs (a stack fetched after secret/addon resolution) need the names restored first.\n\n```go\nfunc Load(content []byte) (*Stackfile, error)\n```\nLoad parses raw YAML bytes into a Stackfile and validates it.\n\n```go\nfunc (sf *Stackfile) ToStack() (openapi.Stack, error)\n```\nToStack converts a validated Stackfile into an API Stack document, ready for the stack apply endpoint. Output is deterministic: resources, volumes, connections, and mappings are emitted in sorted order.\n\n```go\ntype VolumeDef struct {\n\tSize       string `yaml:\"size\"`\n\tAccessMode string `yaml:\"access_mode,omitempty\"`\n}\n```\n\n```go\ntype VolumeMountDef struct {\n\tName string `yaml:\"name\"`\n\tPath string `yaml:\"path\"`\n}\n```\n\n","path":"github.com/Stackdome/stackdome/pkg/stackfile","name":"stackfile","synopsis":"","isRedistributable":true}
