diff --git a/fedilogue/config.go b/fedilogue/config.go index 23922b3..d799f21 100644 --- a/fedilogue/config.go +++ b/fedilogue/config.go @@ -6,15 +6,6 @@ import ( "muzzammil.xyz/jsonc" ) -// Database - Database configuration used by config.go -type Database struct { - Host string `"json:host"` - Port int `"json:port"` - Username string `"json:username"` - Password string `"json:password"` - Workers int `"json:workers"` -} - // MassFollower - Mass follower configuration used by config.go type MassFollower struct { Acct string `"json:acct"` @@ -49,7 +40,6 @@ type Settings struct { Proxies []Proxy `"json:proxies"` Externalaccounts []ExtAccount `"json:externalaccounts"` MassFollowers []MassFollower `"json:massfollowers"` - Database Database `"json:database"` LogLevel int `"json:loglevel"` } diff --git a/fedilogue/config.jsonc.sample b/fedilogue/config.jsonc.sample index f18f1f9..88b946e 100644 --- a/fedilogue/config.jsonc.sample +++ b/fedilogue/config.jsonc.sample @@ -80,15 +80,6 @@ } ], - // Requires a postgres database - "database": { - "host": "127.0.0.1", - "port": 5432, - "username": "fedilogue", - "password": "", - "workers": 4 - }, - /* Log Level: * 0 = No logs diff --git a/fedilogue/db.go b/fedilogue/db.go index dfae8b4..eca817b 100644 --- a/fedilogue/db.go +++ b/fedilogue/db.go @@ -1,8 +1,8 @@ package main import ( + "os" "context" - "fmt" "github.com/jackc/pgx/v4/pgxpool" ) @@ -10,8 +10,7 @@ var pool *pgxpool.Pool func getDbPool() *pgxpool.Pool { // Setup Database - dbURI := fmt.Sprintf("postgres://%s:%s@%s:%d/fedilogue", settings.Database.Username, settings.Database.Password, settings.Database.Host, settings.Database.Port) - pool, err := pgxpool.Connect(context.Background(), dbURI) + pool, err := pgxpool.Connect(context.Background(), os.Getenv("DATABASE_URL")) if err != nil { logFatal.Fatal("Unable to connect to database:", err) }