mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
d50eeea114
1. Split the oversized `cmd/agent` entrypoint into a multi-file package and update dev/build scripts to use the package path instead of compiling `main.go` directly. 2. Add a new `memoh` terminal UI for local bot chat, with Bubble Tea
28 lines
520 B
Go
28 lines
520 B
Go
package tui
|
|
|
|
import (
|
|
"fmt"
|
|
"io/fs"
|
|
"os"
|
|
|
|
dbembed "github.com/memohai/memoh/db"
|
|
"github.com/memohai/memoh/internal/config"
|
|
)
|
|
|
|
func ProvideConfig() (config.Config, error) {
|
|
cfgPath := os.Getenv("CONFIG_PATH")
|
|
cfg, err := config.Load(cfgPath)
|
|
if err != nil {
|
|
return config.Config{}, fmt.Errorf("load config: %w", err)
|
|
}
|
|
return cfg, nil
|
|
}
|
|
|
|
func MigrationsFS() fs.FS {
|
|
sub, err := fs.Sub(dbembed.MigrationsFS, "migrations")
|
|
if err != nil {
|
|
panic(fmt.Sprintf("embedded migrations: %v", err))
|
|
}
|
|
return sub
|
|
}
|