From 897b7eb6448f7afa601695e82c03e382b4409662 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Tue, 2 Jul 2024 15:07:16 +0100 Subject: [PATCH] Update roles/home/aichat.nix --- roles/home/aichat.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/roles/home/aichat.nix b/roles/home/aichat.nix index 39d6939..d95cfd1 100644 --- a/roles/home/aichat.nix +++ b/roles/home/aichat.nix @@ -111,6 +111,43 @@ roles = '' ### INPUT: + diff --git a/pkg/database/client.go b/pkg/database/client.go + index 003740f..6fc4861 100644 + --- a/pkg/database/client.go + +++ b/pkg/database/client.go + @@ -24,9 +24,12 @@ var ErrNilDatabaseClient = errors.New("database client is nil after setup") + + // InitDB initializes the database with the given application name and optional dbpath for SQLite. + func InitDB(appName string, dbpath ...string) error { + - cfg := config.New() + + var ( + + psqlReadReplica string + + err error + + ) + + - var err error + + cfg := config.New() + + // Set up a new logger with your required configuration. + newLogger := logger.New( + @@ -38,9 +41,8 @@ func InitDB(appName string, dbpath ...string) error { + }, + ) + + - // Load PostgreSQL configurations + - var psqlReadReplica string + psqlSource, err := cfg.Load(config.PSQL.String()) + + + if err != nil { + log.Println("PSQL not set, using SQLite instead.") + } else { + + ### OUTPUT: + + style(database/client): group together `psqlReadReplica` and `err` in function's prologue + + ### INPUT: + diff --git a/structs/routing_test.go b/structs/routing_test.go index 2e19254..04191cc 100644 --- a/structs/routing_test.go