feat: add db management scripts

This commit is contained in:
2026-03-28 23:22:47 -05:00
parent a9ca077edd
commit 35314e6e85
5 changed files with 195 additions and 141 deletions

34
internal/config/main.go Normal file
View File

@@ -0,0 +1,34 @@
package config
import (
"log"
"os"
"github.com/joho/godotenv"
)
type dbConfig struct {
Url string
}
func loadEnv() {
err := godotenv.Load()
if err != nil {
log.Println("Warning: could not load .env file")
}
}
func getDbConfig() *dbConfig {
loadEnv()
dbUrl := os.Getenv("PG_FROM_DB_URL")
if dbUrl == "" {
log.Fatal("PG_FROM_DB_URL environment variable not set")
}
return &dbConfig{
Url: dbUrl,
}
}
var Db *dbConfig = getDbConfig()