feat: homedir config
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"bitbucket.bit.admin.ch/scm/~u80859501/pierre-bot/internal/chatter"
|
||||
"bitbucket.bit.admin.ch/scm/~u80859501/pierre-bot/internal/gitadapters"
|
||||
@@ -36,13 +38,19 @@ type Config struct {
|
||||
|
||||
func main() {
|
||||
cfg := &Config{}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Fatalf("could not find home directory: %v", err)
|
||||
}
|
||||
|
||||
defaultConfig := filepath.Join(home, ".config", "pierre", "config.yaml")
|
||||
|
||||
// Parse flags, env vars, and config files
|
||||
kong.Parse(cfg,
|
||||
kong.Name("pierre"),
|
||||
kong.Description("AI-powered Pull Request reviewer for Bitbucket"),
|
||||
kong.UsageOnError(),
|
||||
kong.Configuration(kongyaml.Loader, "config.yaml", "~/.config/pierre/config.yaml"),
|
||||
kong.Configuration(kongyaml.Loader, "config.yaml", defaultConfig),
|
||||
)
|
||||
|
||||
// Initialize Bitbucket Adapter
|
||||
|
||||
Reference in New Issue
Block a user