From d53c20d209e3b84b7a67a2b6d0a30b2513e7cede Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sun, 4 Oct 2026 03:47:17 +1100 Subject: [PATCH] fix(configuration): an overlay stands in for a missing config file; dev overlay is complete --- deployments/dev.toml | 2 ++ internal/app/archiemessaging/config.go | 2 +- internal/app/archieui/config.go | 2 +- internal/infrastructure/configuration/loader.go | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deployments/dev.toml b/deployments/dev.toml index 630952305..6d338ecdf 100644 --- a/deployments/dev.toml +++ b/deployments/dev.toml @@ -12,6 +12,8 @@ # fails closed without a PostgreSQL URL. This must reach the `postgres` # service in docker-compose.yml, which `task dev` brings up first via # dev:postgres -- keep the URL and that service in agreement. +bot_user = "archie-dev" + database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable" [web] diff --git a/internal/app/archiemessaging/config.go b/internal/app/archiemessaging/config.go index 387e65809..78f6fcc3f 100644 --- a/internal/app/archiemessaging/config.go +++ b/internal/app/archiemessaging/config.go @@ -80,7 +80,7 @@ func Resolve(o Options, log *slog.Logger) (ResolvedConfig, error) { } func readProjection(path, overlay string, log *slog.Logger) (projection, bool, error) { - if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) { + if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) && overlay == "" { return projection{}, false, nil } doc, err := configuration.New(log).Resolve(path, overlay) diff --git a/internal/app/archieui/config.go b/internal/app/archieui/config.go index 0792fbf3b..6f82e8ada 100644 --- a/internal/app/archieui/config.go +++ b/internal/app/archieui/config.go @@ -41,7 +41,7 @@ func Resolve(o Options, log *slog.Logger) (Options, error) { // the UI process is allowed to see. An absent source is not an error (the // process is fully drivable by flags); an unreadable or invalid one is. func readProjection(path, overlay string, log *slog.Logger) (projection, bool, error) { - if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) { + if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) && overlay == "" { return projection{}, false, nil } doc, err := configuration.New(log).Resolve(path, overlay) diff --git a/internal/infrastructure/configuration/loader.go b/internal/infrastructure/configuration/loader.go index 952922fa7..6ddc9027c 100644 --- a/internal/infrastructure/configuration/loader.go +++ b/internal/infrastructure/configuration/loader.go @@ -1,7 +1,9 @@ package configuration import ( + "errors" "fmt" + "io/fs" "log/slog" "os" "path/filepath" @@ -96,6 +98,11 @@ func (l *Loader) File(path string) (*Document, error) { // tooling share the exact same precedence and validation rules. func (l *Loader) Resolve(basePath, overlayPath string) (*Document, error) { info, err := os.Stat(basePath) + if errors.Is(err, fs.ErrNotExist) && overlayPath != "" { + // An overlay alone is a complete source: a dev stack runs without the + // operator's config file. + return l.Resolve(overlayPath, "") + } if err != nil { return nil, fmt.Errorf("%w: config source %s: %w", ErrUnreadable, basePath, err) }