Files
go-migrate-db/internal/app/config/main.go
Kylesoda 7f3d2b8cc4 refactor: rename Batch to Partition across pipeline
Rename internal types and channels from Batch to Partition for consistency with the data model.
2026-04-11 18:00:00 -05:00

42 lines
694 B
Go

package config
import (
"os"
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
)
type appConfig struct {
SourceDbUrl string
TargetDbUrl string
}
func loadEnv() {
err := godotenv.Load()
if err != nil {
log.Warn("Warning: could not load .env file")
}
}
func getAppConfig() appConfig {
loadEnv()
sourceDbUrl := os.Getenv("SOURCE_DB_URL")
if sourceDbUrl == "" {
log.Fatal("SOURCE_DB_URL environment variable not set")
}
targetDbUrl := os.Getenv("TARGET_DB_URL")
if targetDbUrl == "" {
log.Fatal("TARGET_DB_URL environment variable not set")
}
return appConfig{
SourceDbUrl: sourceDbUrl,
TargetDbUrl: targetDbUrl,
}
}
var App appConfig = getAppConfig()