diff options
| author | Claude <noreply@anthropic.com> | 2026-08-05 23:14:29 -0500 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-08-05 23:14:29 -0500 |
| commit | 9f7c9f2f31acd7bc544dd988af1c8c2fe63ec504 (patch) | |
| tree | 6d7ab2a965c3e138a56c625197658ef2b324b045 /internal/appmeta | |
Initial commit of skiff scaffolding
Diffstat (limited to 'internal/appmeta')
| -rw-r--r-- | internal/appmeta/appmeta.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/appmeta/appmeta.go b/internal/appmeta/appmeta.go new file mode 100644 index 0000000..61ceb18 --- /dev/null +++ b/internal/appmeta/appmeta.go @@ -0,0 +1,35 @@ +// Package appmeta stores the small amount of per-app networking config +// Skiff itself needs (IP, port, health check) that isn't already implied by +// jail.conf/rc.conf - a flat file living with the app's own data, not a +// separate control-plane database. +package appmeta + +import ( + "encoding/json" + "os" +) + +type Meta struct { + IP string `json:"ip"` + Port int `json:"port"` + HealthPath string `json:"health_path"` + ServerName string `json:"server_name"` +} + +func Write(path string, m Meta) error { + b, err := json.MarshalIndent(m, "", " ") + if err != nil { + return err + } + return os.WriteFile(path, b, 0644) +} + +func Read(path string) (Meta, error) { + var m Meta + b, err := os.ReadFile(path) + if err != nil { + return m, err + } + err = json.Unmarshal(b, &m) + return m, err +} |
