Documentation
¶
Overview ¶
Package config is the schema of pogi.yaml: server settings, seed resources, CloudFormation stacks, chaos rules and IAM identities. It imports nothing from pogi so every package can use it.
Index ¶
- func CheckRelay(relay string) error
- func Find(explicit string) string
- type AI
- type AWSIdentities
- type CORS
- type Chaos
- type Docker
- type Email
- type File
- type IAM
- type Identities
- type Item
- type Items
- type Lambda
- type Resources
- type Role
- type Server
- type Services
- type Stack
- type Storage
- type TLS
- type Typed
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRelay ¶
CheckRelay checks an email relay URL, smtp://[user:pass@]host[:port]; empty is none.
Types ¶
type AI ¶
type AI struct {
Endpoint string `yaml:"endpoint"`
APIKey string `yaml:"apiKey"`
Models map[string]string `yaml:"models"` // service model id glob → local model
Timeout time.Duration `yaml:"timeout"` // longest one model call; 0 means 5m
}
AI is an optional OpenAI-compatible endpoint (Ollama, LM Studio) that Bedrock and the language services answer with.
type AWSIdentities ¶
AWSIdentities are IAM users (with fixed access keys) and roles.
type Chaos ¶
type Chaos struct {
Name string `yaml:"name"`
Cloud string `yaml:"cloud"`
Service string `yaml:"service"`
Op string `yaml:"op"`
Region string `yaml:"region"`
Rate float64 `yaml:"rate"` // 0..1; 0 means always
Latency time.Duration `yaml:"latency"`
Status int `yaml:"status"`
Code string `yaml:"code"`
Message string `yaml:"message"`
}
Chaos is a fault-injection rule (see core.Rule).
type Docker ¶
type Docker struct {
Host string `yaml:"host"` // empty: auto-detect Docker, Podman, Colima, OrbStack
Network string `yaml:"network"` // default "pogi"
Images map[string]string `yaml:"images"` // e.g. rds.postgres: postgres:16-alpine
}
Docker is the container engine pogi drives when one is running.
type Email ¶
type Email struct {
SMTPPort int `yaml:"smtpPort"` // 2525 by default; -1 turns it off
Relay string `yaml:"relay"` // smtp://[user:pass@]host:port
}
Email is SES's SMTP side: the port mail can be sent to, and an SMTP server (Mailpit, MailHog) every message sent through SES also goes to.
type File ¶
type File struct {
Path string `yaml:"-"` // where it was loaded from, for error messages
Version int `yaml:"version"`
Server Server `yaml:"server"`
Services Services `yaml:"services"`
Storage Storage `yaml:"storage"`
IAM IAM `yaml:"iam"`
Lambda Lambda `yaml:"lambda"`
Docker Docker `yaml:"docker"`
AI AI `yaml:"ai"`
Email Email `yaml:"email"`
Chaos []Chaos `yaml:"chaos"`
Identities Identities `yaml:"identities"`
Resources Resources `yaml:"resources"`
Stacks []Stack `yaml:"stacks"`
}
File is a parsed pogi.yaml. Zero values mean "not set": defaults, environment variables and flags fill them in (flags > env > file > defaults).
type Identities ¶
type Identities struct {
AWS AWSIdentities `yaml:"aws"`
}
Identities are IAM users and roles created at startup (and after a reset).
type Items ¶
type Items []Item
Items accepts three spellings:
buckets: [uploads, {name: logs, versioning: true}] # names or maps
secrets: {db-password: hunter2} # name → value
queues: {jobs: {delaySeconds: 5}} # name → properties
func (Items) MarshalYAML ¶
MarshalYAML writes items in list form, for `pogi config print`.
type Lambda ¶
type Lambda struct {
Executor string `yaml:"executor"`
WarmPool int `yaml:"warmPool"`
InitTimeout time.Duration `yaml:"initTimeout"` // longest a new environment may take to start; 0 means 10s, as on AWS
}
Lambda is the function executor (auto | native | docker).
type Resources ¶
type Resources struct {
AWS map[string]map[string]Items `yaml:"aws"`
GCP map[string]map[string]Items `yaml:"gcp"`
Azure map[string]map[string]Items `yaml:"azure"`
Typed []Typed `yaml:"typed"`
}
Resources are seeded at startup and after every reset; existing ones are skipped. Friendly entries are keyed cloud → service → kind, e.g. aws.s3.buckets.
type Role ¶
type Role struct {
Name string `yaml:"name"`
Account string `yaml:"account"`
Trust string `yaml:"trust"`
Policies []string `yaml:"policies"`
Inline map[string]any `yaml:"inline"`
}
Role is an IAM role; Trust is a service principal (lambda.amazonaws.com), an account id or ARN, or "*".
type Server ¶
type Server struct {
Port int `yaml:"port"`
Host string `yaml:"host"` // anything but loopback needs AllowExternal
Region string `yaml:"region"` // the partition follows the region (cn-*, us-gov-*)
Hostname string `yaml:"hostname"` // localhost; aws.localhost enables virtual-host style
TLS TLS `yaml:"tls"` // empty: pogi's local CA
CORS CORS `yaml:"cors"` // extra origins allowed to call the APIs from a browser
AllowExternal bool `yaml:"allowExternal"` // allow a non-loopback Host
MaxUploadMB int `yaml:"maxUploadMB"` // largest upload in MiB; 0 means 10
}
Server is where and how pogi listens.
type Stack ¶
type Stack struct {
Name string `yaml:"name"`
Template string `yaml:"template"` // path, relative to the config file
Parameters map[string]string `yaml:"parameters"`
Account string `yaml:"account"`
Region string `yaml:"region"`
Line int `yaml:"-"`
}
Stack is a CloudFormation stack deployed at startup.
type Storage ¶
type Storage struct {
Mode string `yaml:"mode"`
Dir string `yaml:"dir"`
FlushInterval time.Duration `yaml:"flushInterval"` // hybrid
Services map[string]string `yaml:"services"` // per-service mode
}
Storage is how state is kept: memory | hybrid | persistent | wal.
type Typed ¶
type Typed struct {
Type string `yaml:"type"`
Name string `yaml:"name"` // optional logical id
Account string `yaml:"account"`
Region string `yaml:"region"`
Properties map[string]any `yaml:"properties"`
Line int `yaml:"-"`
}
Typed is a resource in CloudFormation form ("AWS::SNS::Topic"); GCP and Azure types follow once the generic engine exists.
type User ¶
type User struct {
Name string `yaml:"name"`
Account string `yaml:"account"`
AccessKey string `yaml:"accessKey"`
SecretKey string `yaml:"secretKey"`
Policies []string `yaml:"policies"` // managed policy ARNs
Inline map[string]any `yaml:"inline"` // policy name → policy document
Groups []string `yaml:"groups"`
}
User is an IAM user; AccessKey and SecretKey make its credentials fixed.